From 42ec2640753650c69385d86c2fbb386d23965c89 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 20 Jun 2021 14:17:31 +0200 Subject: tokenize: strdup() each individual argv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of referencing the un-tokenized “raw” command string, strdup() each argv. This way, the input string can be ‘const’. --- slave.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'slave.c') diff --git a/slave.c b/slave.c index 8e800214..ba2d0867 100644 --- a/slave.c +++ b/slave.c @@ -293,9 +293,7 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv, char **shell_argv = NULL; if (argc == 0) { - char *shell_copy = xstrdup(conf_shell); - if (!tokenize_cmdline(shell_copy, &_shell_argv)) { - free(shell_copy); + if (!tokenize_cmdline(conf_shell, &_shell_argv)) { (void)!write(fork_pipe[1], &errno, sizeof(errno)); _exit(0); } -- cgit v1.3