From: Sidharth Anupkrishnan Date: Mon, 6 Jul 2020 09:15:46 +0000 (+0530) Subject: client: Fix setxattr with 0 size specified X-Git-Tag: wip-pdonnell-testing-20200918.022351~752^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=dd8f1a544d5c98277d42ecace4dad854c428b262;p=ceph-ci.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 --- diff --git a/src/client/Client.cc b/src/client/Client.cc index c2129b01652..6aa7d3fc2cb 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11619,6 +11619,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);