From b7f89cb7b0f51df9b0264c20acfab863bf6a655f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 29 Oct 2012 08:33:52 -0700 Subject: [PATCH] os/chain_xattr: fix listxattr buffer size Intenrally allocate 2x the raw listxattr result; tell the user the same. Signed-off-by: Sage Weil --- src/os/chain_xattr.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/chain_xattr.cc b/src/os/chain_xattr.cc index bab02726c0e08..ea9bcdd202f64 100644 --- a/src/os/chain_xattr.cc +++ b/src/os/chain_xattr.cc @@ -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) -- 2.39.5