From b7d8567145b948c7a51b6ecccfd5ff5c10c5a17a Mon Sep 17 00:00:00 2001 From: Manikandan Selvaganesh Date: Tue, 17 Feb 2015 17:17:40 +0530 Subject: posix : unchecked return value coverity fix. CID : 1124364 Change-Id: I1e16e3ff46b191ba2ea527e628c77a99a56f6c31 BUG: 789278 Signed-off-by: Manikandan Selvaganesh Reviewed-on: http://review.gluster.org/9667 Reviewed-by: Niels de Vos Reviewed-by: Kaleb KEITHLEY Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/storage/posix/src/posix.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'xlators/storage') 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); } -- cgit