From 7f93d7305bf2e8a79247a2edd40d9bf4c5e164dd Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Sat, 22 Sep 2012 12:04:42 +0000 Subject: [PATCH] E17: Patch from Maxime Villard (rustyBSD) I. (strncmp(p, p2, PATH_MAX) == 0) && ((p[p2_len] == '/') || (p[p2_len] == '\0'))) Here we want to know if p and p2 are the same. It's easier to do a simple 'strcmp(p, p2)', and it's useless to check the value of p[p2_len], because if p = p2, p[p2_len] will always be \0. II. Check the string as for E_FM_OP_MOVE. III. Just a simplification. it was something like: if (type == E_FM_OP_COPY) X; if (type == E_FM_OP_COPY) Y; else ... I just replaced by if (type == E_FM_OP_COPY) { X; Y; } else ... SVN revision: 77015 --- src/bin/e_fm_op.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/bin/e_fm_op.c b/src/bin/e_fm_op.c index 488db304c..5d17ab4ce 100644 --- a/src/bin/e_fm_op.c +++ b/src/bin/e_fm_op.c @@ -235,12 +235,11 @@ main(int argc, char **argv) { p = argv[i]; const char *name; - int name_len; + size_t name_len; /* Don't move a dir into itself */ if (ecore_file_is_dir(p) && - (strncmp(p, p2, PATH_MAX) == 0) && - ((p[p2_len] == '/') || (p[p2_len] == '\0'))) + (strcmp(p, p2) == 0)) goto skip_arg; name = ecore_file_file_get(p); @@ -258,7 +257,16 @@ main(int argc, char **argv) } else { - if (type == E_FM_OP_MOVE) + if (type == E_FM_OP_RENAME) + { + if (!strcmp(argv[i],buf)) + goto skip_arg; + + if (buf[0]!='/') + _E_FM_OP_ERROR_SEND_SCAN(0, E_FM_OP_ERROR, + "Unknown destination '%s': %s.", buf); + } + else if (type == E_FM_OP_MOVE) { if (!strcmp(argv[i],buf)) goto skip_arg; @@ -962,11 +970,9 @@ _e_fm_op_rollback(E_Fm_Op_Task *task) } } E_FREE(task->data); + _e_fm_op_update_progress(task, -task->dst.done, + -task->src.st.st_size - (task->link ? REMOVECHUNKSIZE : 0)); } - - if (task->type == E_FM_OP_COPY) - _e_fm_op_update_progress(task, -task->dst.done, - -task->src.st.st_size - (task->link ? REMOVECHUNKSIZE : 0)); else _e_fm_op_update_progress(task, -REMOVECHUNKSIZE, -REMOVECHUNKSIZE); }