summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
diff options
context:
space:
mode:
authorRahul C S <rahulcs@redhat.com>2012-01-03 22:24:22 +0530
committerVijay Bellur <vijay@gluster.com>2012-01-03 09:29:11 -0800
commita6777636fbb94a34a37cadd7840429f72fc5b747 (patch)
treef286a6b8aa93c22695b4a126f66f3d6aff091f41 /xlators/storage/posix
parentfb825bccca8348cbff64edb239ee0cd66942984e (diff)
Avoid setting dict when size is -1
when lgetxattr fails and returns size as -1, we still try to set the dict. Instead it should set proper errno & exit. Change-Id: I282dc0765e562bd9bbcf852453cd3b72d918b269 BUG: 771313 Signed-off-by: Rahul C S <rahulcs@redhat.com> Reviewed-on: http://review.gluster.com/2555 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/storage/posix')
-rw-r--r--xlators/storage/posix/src/posix.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index ab512af15ac..cf5d855fede 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -2564,6 +2564,11 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
strcpy (key, name);
size = sys_lgetxattr (real_path, key, NULL, 0);
+ if (size == -1) {
+ op_ret = -1;
+ op_errno = errno;
+ goto out;
+ }
value = GF_CALLOC (size + 1, sizeof(char), gf_posix_mt_char);
if (!value) {
op_ret = -1;