From 21e4db42468d5bb7ebd9fa6a91461edd11b2a6da Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Tue, 22 Feb 2011 05:25:11 +0000 Subject: storage/posix: set op_ret to -1 when setgid_override fails. Signed-off-by: Raghavendra G Signed-off-by: Anand V. Avati BUG: 2409 (crash in stat prefetch) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2409 --- xlators/storage/posix/src/posix.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'xlators/storage') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index f46e10e9acf..b63300fb945 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1068,8 +1068,11 @@ posix_mknod (call_frame_t *frame, xlator_t *this, gid = frame->root->gid; op_ret = setgid_override (this, real_path, &gid); - if (op_ret < 0) + if (op_ret < 0) { + op_errno = -op_ret; + op_ret = -1; goto out; + } SET_FS_ID (frame->root->uid, gid); pathdup = gf_strdup (real_path); @@ -1336,8 +1339,11 @@ posix_mkdir (call_frame_t *frame, xlator_t *this, } op_ret = setgid_override (this, real_path, &gid); - if (op_ret < 0) + if (op_ret < 0) { + op_errno = -op_ret; + op_ret = -1; goto out; + } SET_FS_ID (frame->root->uid, gid); pathdup = gf_strdup (real_path); @@ -1625,8 +1631,11 @@ posix_symlink (call_frame_t *frame, xlator_t *this, gid = frame->root->gid; op_ret = setgid_override (this, real_path, &gid); - if (op_ret < 0) + if (op_ret < 0) { + op_errno = -op_ret; + op_ret = -1; goto out; + } SET_FS_ID (frame->root->uid, gid); pathdup = gf_strdup (real_path); @@ -2026,8 +2035,9 @@ posix_create (call_frame_t *frame, xlator_t *this, gid = frame->root->gid; op_ret = setgid_override (this, real_path, &gid); - if (op_ret < 0) { + op_errno = -op_ret; + op_ret = -1; goto out; } @@ -2172,8 +2182,11 @@ posix_open (call_frame_t *frame, xlator_t *this, MAKE_REAL_PATH (real_path, this, loc->path); op_ret = setgid_override (this, real_path, &gid); - if (op_ret < 0) + if (op_ret < 0) { + op_errno = -op_ret; + op_ret = -1; goto out; + } SET_FS_ID (frame->root->uid, gid); -- cgit