mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Fix calculation of remaining copybuf bytes
Start with PATH_MAX bytes and then double each time.
This commit is contained in:
parent
511a1031b5
commit
f652a4fecb
3
nnn.c
3
nnn.c
|
@ -642,7 +642,7 @@ writecp(const char *buf, const size_t buflen)
|
||||||
static bool
|
static bool
|
||||||
appendfilepath(const char *path, const size_t len)
|
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;
|
copybuflen += PATH_MAX;
|
||||||
pcopybuf = xrealloc(pcopybuf, copybuflen);
|
pcopybuf = xrealloc(pcopybuf, copybuflen);
|
||||||
if (!pcopybuf) {
|
if (!pcopybuf) {
|
||||||
|
@ -3055,7 +3055,6 @@ nochange:
|
||||||
writecp(pcopybuf, copybufpos - 1); /* Truncate NULL from end */
|
writecp(pcopybuf, copybufpos - 1); /* Truncate NULL from end */
|
||||||
else
|
else
|
||||||
spawn(copier, pcopybuf, NULL, NULL, F_NOTRACE);
|
spawn(copier, pcopybuf, NULL, NULL, F_NOTRACE);
|
||||||
DPRINTF_S(pcopybuf);
|
|
||||||
if (!len)
|
if (!len)
|
||||||
printmsg("files copied");
|
printmsg("files copied");
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in a new issue