From: Sidharth Anupkrishnan Date: Mon, 6 Jul 2020 09:15:46 +0000 (+0530) Subject: client: Fix setxattr with 0 size specified X-Git-Tag: v15.2.5~127^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=60fd8d8dbb4f678c4810edc69b765bddc541816a;p=ceph.git client: Fix setxattr with 0 size specified When xattrs are set with 0 size, the value should be set to an empty string. Signed-off-by: Sidharth Anupkrishnan (cherry picked from commit dd8f1a544d5c98277d42ecace4dad854c428b262) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index c84da997a33..b964fc3dc09 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11565,6 +11565,12 @@ int Client::_setxattr(Inode *in, const char *name, const void *value, return -EROFS; } + if (size == 0) { + value = ""; + } else if (value == NULL) { + return -EINVAL; + } + bool posix_acl_xattr = false; if (acl_type == POSIX_ACL) posix_acl_xattr = !strncmp(name, "system.", 7);