From 24717f14fa9e409f01f89c0905163b0db1e40729 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Mon, 16 Jul 2012 03:51:10 +0530 Subject: storage/posix: use ssize_t variable to get the return value of getxattr Change-Id: Ida065e108a1d2a61b134fb847e8c4981b46fc3c6 BUG: 838195 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.com/3673 Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY Reviewed-by: Anand Avati --- xlators/storage/posix/src/posix-helpers.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'xlators/storage/posix/src/posix-helpers.c') diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 3c19ba7a3..c1fc9721e 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -213,9 +213,9 @@ _posix_xattr_get_set (dict_t *xattr_req, if (!value) return; - ret = sys_lgetxattr (filler->real_path, key, value, - xattr_size); - if (ret <= 0) { + xattr_size = sys_lgetxattr (filler->real_path, key, value, + xattr_size); + if (xattr_size <= 0) { gf_log (filler->this->name, GF_LOG_WARNING, "getxattr failed. path: %s, key: %s", filler->real_path, key); @@ -243,14 +243,17 @@ int posix_fill_gfid_path (xlator_t *this, const char *path, struct iatt *iatt) { int ret = 0; + ssize_t size = 0; if (!iatt) return 0; - ret = sys_lgetxattr (path, GFID_XATTR_KEY, iatt->ia_gfid, 16); + size = sys_lgetxattr (path, GFID_XATTR_KEY, iatt->ia_gfid, 16); /* Return value of getxattr */ - if ((ret == 16) || (ret == -1)) + if ((size == 16) || (size == -1)) ret = 0; + else + ret = size; return ret; } @@ -260,14 +263,17 @@ int posix_fill_gfid_fd (xlator_t *this, int fd, struct iatt *iatt) { int ret = 0; + ssize_t size = 0; if (!iatt) return 0; - ret = sys_fgetxattr (fd, GFID_XATTR_KEY, iatt->ia_gfid, 16); + size = sys_fgetxattr (fd, GFID_XATTR_KEY, iatt->ia_gfid, 16); /* Return value of getxattr */ - if ((ret == 16) || (ret == -1)) + if ((size == 16) || (size == -1)) ret = 0; + else + ret = size; return ret; } @@ -451,6 +457,7 @@ posix_gfid_set (xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req) void *uuid_req = NULL; uuid_t uuid_curr; int ret = 0; + ssize_t size = 0; struct stat stat = {0, }; @@ -460,8 +467,8 @@ posix_gfid_set (xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req) if (sys_lstat (path, &stat) != 0) goto out; - ret = sys_lgetxattr (path, GFID_XATTR_KEY, uuid_curr, 16); - if (ret == 16) { + size = sys_lgetxattr (path, GFID_XATTR_KEY, uuid_curr, 16); + if (size == 16) { ret = 0; goto verify_handle; } -- cgit