]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/chain_xattr: fix listxattr buffer size
authorSage Weil <sage@inktank.com>
Mon, 29 Oct 2012 15:33:52 +0000 (08:33 -0700)
committerSage Weil <sage@inktank.com>
Mon, 5 Nov 2012 08:13:53 +0000 (00:13 -0800)
Intenrally allocate 2x the raw listxattr result; tell the user the same.

Signed-off-by: Sage Weil <sage@inktank.com>
src/os/chain_xattr.cc

index bab02726c0e08cfd3ee6480dc67f5483b53638fc..ea9bcdd202f6439f75682f9ec3086af97cd51803 100644 (file)
@@ -335,7 +335,7 @@ int chain_listxattr(const char *fn, char *names, size_t len) {
   int r;
 
   if (!len)
-    return ::ceph_os_listxattr(fn, names, len);
+    return ::ceph_os_listxattr(fn, names, len) * 2;
 
   r = ::ceph_os_listxattr(fn, 0, 0);
   if (r < 0)
@@ -381,7 +381,7 @@ int chain_flistxattr(int fd, char *names, size_t len) {
   int r;
 
   if (!len)
-    return ::ceph_os_flistxattr(fd, names, len);
+    return ::ceph_os_flistxattr(fd, names, len) * 2;
 
   r = ::ceph_os_flistxattr(fd, 0, 0);
   if (r < 0)