diff options
author | Jiffin Tony Thottan <jthottan@gmail.com> | 2016-02-22 16:50:12 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2016-02-23 04:49:34 -0800 |
commit | 0bc54f3ea7a56040df4a67b8626200b47fa3d779 (patch) | |
tree | 17191e2802b7dd1287b019043a95dfc86670667f /api/src | |
parent | 3ca140f011faa9d92a4b3889607fefa33ae6de76 (diff) |
gfapi : fixing listxattr call for handle ops
Currently listxattr is called as part of glfs_h_getxattrs() when NULL is
passed to name field, but glfs_h_getxattrs_common() inside it will error
out if name is NULL. Therefore listxattr is broken for handle ops.
Change-Id: I9ced6e33525e1e1a50298972e4922c954fc2b223
BUG: 1310620
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: http://review.gluster.org/13482
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/glfs-handleops.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index a135f77883e..f700f1a6808 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -313,7 +313,8 @@ GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_getattrs, 3.4.2); int glfs_h_getxattrs_common (struct glfs *fs, struct glfs_object *object, - dict_t **xattr, const char *name) + dict_t **xattr, const char *name, + gf_boolean_t is_listxattr) { int ret = 0; xlator_t *subvol = NULL; @@ -326,16 +327,17 @@ glfs_h_getxattrs_common (struct glfs *fs, struct glfs_object *object, return -1; } - if (!name || *name == '\0') { - errno = EINVAL; - return -1; - } + if (!is_listxattr) { + if (!name || *name == '\0') { + errno = EINVAL; + return -1; + } - if (strlen(name) > GF_XATTR_NAME_MAX) { - errno = ENAMETOOLONG; - return -1; + if (strlen(name) > GF_XATTR_NAME_MAX) { + errno = ENAMETOOLONG; + return -1; + } } - /* get the active volume */ subvol = glfs_active_subvol (fs); if (!subvol) { @@ -385,7 +387,8 @@ pub_glfs_h_getxattrs (struct glfs *fs, struct glfs_object *object, DECLARE_OLD_THIS; __GLFS_ENTRY_VALIDATE_FS (fs, invalid_fs); - ret = glfs_h_getxattrs_common (fs, object, &xattr, name); + ret = glfs_h_getxattrs_common (fs, object, &xattr, name, + (name == NULL)); if (ret) goto out; @@ -2092,7 +2095,8 @@ pub_glfs_h_acl_get (struct glfs *fs, struct glfs_object *object, } else new_object = object; - ret = glfs_h_getxattrs_common (fs, new_object, &xattr, acl_key); + ret = glfs_h_getxattrs_common (fs, new_object, &xattr, acl_key, + _gf_false); if (ret) goto out; |