aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-04-14 19:56:04 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-04-14 20:40:07 +0530
commitf652a4fecb12deb5a35301ea7a57ff5368457115 (patch)
treef8d0cc052ede2204e40763286d57d5dfc810473b
parent511a1031b52616bec965b55700759992158bfd43 (diff)
downloadnnn-f652a4fecb12deb5a35301ea7a57ff5368457115.tar.gz
Fix calculation of remaining copybuf bytes
Start with PATH_MAX bytes and then double each time.
-rw-r--r--nnn.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/nnn.c b/nnn.c
index 25a1c8c..e25e7c6 100644
--- a/nnn.c
+++ b/nnn.c
@@ -642,7 +642,7 @@ writecp(const char *buf, const size_t buflen)
static bool
appendfilepath(const char *path, const size_t len)
{
- if ((copybufpos >= copybuflen) || (len > (copybuflen - (copybufpos + 3)))) {
+ if ((copybufpos >= copybuflen) || ((len + 3) > (copybuflen - copybufpos))) {
copybuflen += PATH_MAX;
pcopybuf = xrealloc(pcopybuf, copybuflen);
if (!pcopybuf) {
@@ -3055,7 +3055,6 @@ nochange:
writecp(pcopybuf, copybufpos - 1); /* Truncate NULL from end */
else
spawn(copier, pcopybuf, NULL, NULL, F_NOTRACE);
- DPRINTF_S(pcopybuf);
if (!len)
printmsg("files copied");
} else