features/trash: More coverity fixes

The following CIDs are being addressed:

1288792
1288794

Change-Id: Ic2cdaf43f05488e04616ceb801b47a47c6a93656
BUG: 789278
Signed-off-by: Anoop C S <achiraya@redhat.com>
Reviewed-on: http://review.gluster.org/10082
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
Anoop C S 2015-03-24 14:34:52 +05:30 committed by Vijay Bellur
parent 5e7cc20d3c
commit d2ada381fe

View File

@ -687,7 +687,7 @@ trash_unlink_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (count == 0)
count = 1;
i++;
if ((i > loop_count) || (count > PATH_MAX))
if (i > loop_count)
break;
tmp_dirname = strchr (tmp_str + count + 1, '/');
}
@ -1026,6 +1026,13 @@ trash_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflags,
* name collisions inside trash
*/
append_time_stamp (local->newpath);
if (strlen (local->newpath) > PATH_MAX) {
STACK_WIND (frame, trash_common_unwind_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->unlink, loc, 0,
xdata);
goto out;
}
LOCK_INIT (&frame->lock);
@ -1397,7 +1404,7 @@ trash_truncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (count == 0)
count = 1;
i++;
if ((i > loop_count) || (count > PATH_MAX))
if (i > loop_count)
break;
tmp_dirname = strchr (tmp_str + count + 1, '/');
}
@ -1522,6 +1529,13 @@ trash_truncate_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* append timestamp to file name so that we can avoid
name collisions inside trash */
append_time_stamp (local->newpath);
if (strlen (local->newpath) > PATH_MAX) {
STACK_WIND (frame, trash_common_unwind_buf_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->truncate,
&local->loc, local->fop_offset, xdata);
goto out;
}
strcpy (loc_newname, local->loc.name);
append_time_stamp (loc_newname);