]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/Tools.pm
safe_read_from: bump default size limit to 1 MiB to match pmxcfs
[pve-common.git] / src / PVE / Tools.pm
index 2f248da0548bf84802ee4b3aee87d35dbea9dd87..a1571ea3d9fa8c05746fea45ad7c525b197d5c6d 100644 (file)
@@ -302,7 +302,7 @@ sub safe_read_from {
     my ($fh, $max, $oneline, $filename) = @_;
 
     # pmxcfs file size limit
-    $max = 512*1024 if !$max;
+    $max = 1024 * 1024 if !$max;
 
     my $subject = defined($filename) ? "file '$filename'" : 'input';
 
@@ -1865,7 +1865,7 @@ sub mount($$$$$) {
 }
 
 # size is optional and defaults to 256, note that xattr limits are FS specific and that xattrs can
-# get arbitrary long. NOTE: $! is set to ENOBUFS if the xattr is longer than the buffer size used.
+# get arbitrary long. pass `0` for $size in array context to get the actual size of a value
 sub getxattr($$;$) {
     my ($path_or_handle, $name, $size) = @_;
     $size //= 256;
@@ -1879,8 +1879,6 @@ sub getxattr($$;$) {
     }
     if ($xattr_size < 0) {
        return undef;
-    } elsif ($xattr_size > $size) {
-       $! = POSIX::ENOBUFS;
     }
     return wantarray ? ($buf, $xattr_size) : $buf;
 }