diff options
author | Manikandan Selvaganesh <mselvaga@redhat.com> | 2015-02-17 17:17:40 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-29 23:54:24 -0700 |
commit | b7d8567145b948c7a51b6ecccfd5ff5c10c5a17a (patch) | |
tree | d25690f52ae68786070438beade51b02dd13398a /xlators/storage/posix/src | |
parent | 683145ae2a8abee02763cef2334556fd39fc635a (diff) |
posix : unchecked return value coverity fix.
CID : 1124364
Change-Id: I1e16e3ff46b191ba2ea527e628c77a99a56f6c31
BUG: 789278
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-on: http://review.gluster.org/9667
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src')
-rw-r--r-- | xlators/storage/posix/src/posix.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index ae08adcc8e0..efbe3583c69 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1734,9 +1734,15 @@ posix_rmdir (call_frame_t *frame, xlator_t *this, strlen ("/") + strlen (gfid_str) + 1); - mkdir (priv->trash_path, 0755); - sprintf (tmp_path, "%s/%s", priv->trash_path, gfid_str); - op_ret = rename (real_path, tmp_path); + op_ret = mkdir (priv->trash_path, 0755); + if (errno != EEXIST && op_ret == -1) { + gf_log (this->name, GF_LOG_ERROR, + "mkdir of %s failed: %s", priv->trash_path, + strerror (errno)); + } else { + sprintf (tmp_path, "%s/%s", priv->trash_path, gfid_str); + op_ret = rename (real_path, tmp_path); + } } else { op_ret = rmdir (real_path); } |