summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/trash/src/trash.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
index a74716dce15..3a65d788ae9 100644
--- a/xlators/features/trash/src/trash.c
+++ b/xlators/features/trash/src/trash.c
@@ -294,7 +294,7 @@ trash_notify_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
data_t *data = NULL;
trash_private_t *priv = NULL;
- int ret = 0;
+ int ret = 0;
priv = this->private;
GF_VALIDATE_OR_GOTO ("trash", priv, out);
@@ -310,14 +310,19 @@ trash_notify_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
} else {
- priv->oldtrash_dir = gf_strdup (data->data);
+ priv->oldtrash_dir = GF_CALLOC (1, PATH_MAX,
+ gf_common_mt_char);
if (!priv->oldtrash_dir) {
gf_log (this->name, GF_LOG_ERROR, "out of memory");
ret = ENOMEM;
goto out;
}
- gf_log (this->name, GF_LOG_DEBUG, "old trash directory"
- " path is %s", data->data);
+ /* appending '/' if it is not present */
+ sprintf (priv->oldtrash_dir, "%s%c", data->data,
+ data->data[strlen(data->data) - 1] != '/' ? '/' : '\0'
+ );
+ gf_log (this->name, GF_LOG_DEBUG, "old trash directory path "
+ "is %s", priv->oldtrash_dir);
}
out:
@@ -382,7 +387,7 @@ trash_internal_op_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *buf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
- if (op_ret != 0)
+ if (op_ret != 0 && !(op_errno == EEXIST))
gf_log (this->name, GF_LOG_ERROR, "mkdir failed for "
"internal op directory : %s", strerror (op_errno));
return op_ret;