Use force only in case of rm

This commit is contained in:
Arun Prakash Jana 2018-12-09 08:00:20 +05:30
parent efe445910f
commit 8eb4cd9e9f
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 7 additions and 9 deletions

View File

@ -3155,24 +3155,22 @@ nochange:
goto nochange; goto nochange;
} }
char force = confirm_force();
if (sel == SEL_CP) { if (sel == SEL_CP) {
snprintf(g_buf, CMD_LEN_MAX, snprintf(g_buf, CMD_LEN_MAX,
#ifdef __linux__ #ifdef __linux__
"xargs -0 -a %s -%c src cp -%cRp src .", "xargs -0 -a %s -%c src cp -iRp src .",
#else #else
"cat %s | xargs -0 -o -%c src cp -%cRp src .", "cat %s | xargs -0 -o -%c src cp -iRp src .",
#endif #endif
g_cppath, REPLACE_STR, force); g_cppath, REPLACE_STR);
} else if (sel == SEL_MV) { } else if (sel == SEL_MV) {
snprintf(g_buf, CMD_LEN_MAX, snprintf(g_buf, CMD_LEN_MAX,
#ifdef __linux__ #ifdef __linux__
"xargs -0 -a %s -%c src mv -%c src .", "xargs -0 -a %s -%c src mv -i src .",
#else #else
"cat %s | xargs -0 -o -%c src mv -%c src .", "cat %s | xargs -0 -o -%c src mv -i src .",
#endif #endif
g_cppath, REPLACE_STR, force); g_cppath, REPLACE_STR);
} else { /* SEL_RMMUL */ } else { /* SEL_RMMUL */
snprintf(g_buf, CMD_LEN_MAX, snprintf(g_buf, CMD_LEN_MAX,
#ifdef __linux__ #ifdef __linux__
@ -3180,7 +3178,7 @@ nochange:
#else #else
"cat %s | xargs -0 -o rm -%cr", "cat %s | xargs -0 -o rm -%cr",
#endif #endif
g_cppath, force); g_cppath, confirm_force());
} }
spawn("sh", "-c", g_buf, path, F_NORMAL | F_SIGINT); spawn("sh", "-c", g_buf, path, F_NORMAL | F_SIGINT);