Fix #301 - use local buffer to avoid overwriting g_buf

This commit is contained in:
Arun Prakash Jana 2019-07-25 19:55:55 +05:30
parent 2a4008c9ab
commit 8fe4761092
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -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)