]> git.proxmox.com Git - pve-common.git/commitdiff
tools: getxattr: document how to get actual argument size
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 19 Oct 2021 07:33:37 +0000 (09:33 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 19 Oct 2021 07:33:37 +0000 (09:33 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Tools.pm

index 2f248da0548bf84802ee4b3aee87d35dbea9dd87..c17198dbae0c75313e919a639affcad952177f2f 100644 (file)
@@ -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;
 }