aboutsummaryrefslogtreecommitdiff
path: root/slave.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-06-20 12:17:31 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-06-20 12:19:22 +0000
commit42ec2640753650c69385d86c2fbb386d23965c89 (patch)
treeb1397db5e2128d97d340260f732bf4b4edce9a1e /slave.c
parentconfig: remove duplicated error logs for invalid colors (diff)
tokenize: strdup() each individual argv
Instead of referencing the un-tokenized “raw” command string, strdup() each argv. This way, the input string can be ‘const’.
Diffstat (limited to 'slave.c')
-rw-r--r--slave.c4
1 files changed, 1 insertions, 3 deletions
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);
}