aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2019-04-07 13:16:55 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2019-04-07 13:16:55 +0100
commite44e2c48dd38e02bccdcdfcf6d64aa63043ddff3 (patch)
tree5a024c159f8bab9213c5f6b3aecb15bfaeeb3840
parentece737274e64b6ac2d11134b61b0ceec50cc91e7 (diff)
downloadrtmux-e44e2c48dd38e02bccdcdfcf6d64aa63043ddff3.tar.gz
rtmux-e44e2c48dd38e02bccdcdfcf6d64aa63043ddff3.tar.bz2
rtmux-e44e2c48dd38e02bccdcdfcf6d64aa63043ddff3.zip
Do not log NULL command.
-rw-r--r--spawn.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/spawn.c b/spawn.c
index b22bf670..37e2a7c4 100644
--- a/spawn.c
+++ b/spawn.c
@@ -210,7 +210,7 @@ spawn_pane(struct spawn_context *sc, char **cause)
struct environ_entry *ee;
char **argv, *cp, **argvp, *argv0, *cwd;
const char *cmd, *tmp;
- int argc, before, full_size;
+ int argc, full_size;
u_int idx;
struct termios now;
u_int hlimit;
@@ -325,13 +325,16 @@ spawn_pane(struct spawn_context *sc, char **cause)
environ_set(child, "SHELL", "%s", new_wp->shell);
/* Log the arguments we are going to use. */
- cp = cmd_stringify_argv(new_wp->argc, new_wp->argv);
log_debug("%s: shell=%s", __func__, new_wp->shell);
- log_debug("%s: cmd=%s", __func__, cp);
- log_debug("%s: cwd=%s", __func__, cwd);
+ if (new_wp->argc != 0) {
+ cp = cmd_stringify_argv(new_wp->argc, new_wp->argv);
+ log_debug("%s: cmd=%s", __func__, cp);
+ free(cp);
+ }
+ if (cwd != NULL)
+ log_debug("%s: cwd=%s", __func__, cwd);
cmd_log_argv(new_wp->argc, new_wp->argv, __func__);
environ_log(child, "%s: environment ", __func__);
- free(cp);
/* Initialize the window size. */
memset(&ws, 0, sizeof ws);