aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-07-25 19:55:55 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-07-25 20:02:54 +0530
commit8fe47610922a37896999d50151ec39cc293ba75e (patch)
treefe05301c0e4063476acf00359933ac7a7475e8d0 /src
parent2a4008c9ab7edbbcf65fc9a05ea4fd7b2ea0a022 (diff)
downloadnnn-8fe47610922a37896999d50151ec39cc293ba75e.tar.gz
Fix #301 - use local buffer to avoid overwriting g_buf
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 2142dfc..6f6f588 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1265,14 +1265,16 @@ finish:
static void archive_selection(const char *cmd, const char *archive, const char *curpath)
{
- snprintf(g_buf, CMD_LEN_MAX,
+ char *buf = (char *)malloc(CMD_LEN_MAX * sizeof(char));
+ snprintf(buf, CMD_LEN_MAX,
#ifdef __linux__
"xargs -0 -a %s %s %s",
#else
"cat %s | xargs -0 -o %s %s",
#endif
g_cppath, cmd, archive);
- spawn("sh", "-c", g_buf, curpath, F_NORMAL);
+ spawn("sh", "-c", buf, curpath, F_NORMAL);
+ free(buf);
}
static bool write_lastdir(const char *curpath)