aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-11-11 04:46:59 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-11-11 05:00:37 +0530
commit721ac62f7212142629de92778be22cc1926ea6a6 (patch)
tree09cba41b0b783bb7730c300b844a995832547462 /src
parent0169232d9c3ac4959688e75ec6986c6d1f917b3c (diff)
downloadnnn-721ac62f7212142629de92778be22cc1926ea6a6.tar.gz
Ensure co file does not have stale paths
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nnn.c b/src/nnn.c
index ba8cef6..75044b6 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2967,6 +2967,20 @@ nochange:
goto nochange;
if (cfg.copymode) {
+ /*
+ * Clear the tmp copy path file on first copy.
+ *
+ * This ensures that when the first file path is
+ * copied into memory (but not written to tmp file
+ * yet to save on writes), the tmp file is cleared.
+ * The user may be in the middle of a multicopy op
+ * and issue a cp, mv of multi-rm assuming the files
+ * in the copy list would be affected. However, these
+ * ops read the source file paths from the tmp file.
+ */
+ if (!ncp)
+ writecp(NULL, 0);
+
r = mkpath(path, dents[cur].name, newpath, PATH_MAX);
if (!appendfpath(newpath, r))
goto nochange;