diff options
author | 2021-03-15 13:06:33 +0000 | |
---|---|---|
committer | 2021-03-15 13:06:33 +0000 | |
commit | 5d57355ae9e3e71f5b19a183a69a79071f13f0f2 (patch) | |
tree | c8016b5f1487f3d1ef3edd12a8d3a17c317faca7 /usr.bin/tmux/cmd-run-shell.c | |
parent | tweaks to system version handling: (diff) | |
download | wireguard-openbsd-5d57355ae9e3e71f5b19a183a69a79071f13f0f2.tar.xz wireguard-openbsd-5d57355ae9e3e71f5b19a183a69a79071f13f0f2.zip |
Do not crash if there is no item to show command error, from Anindya
Mukherjee.
Diffstat (limited to 'usr.bin/tmux/cmd-run-shell.c')
-rw-r--r-- | usr.bin/tmux/cmd-run-shell.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c index 5a30b93be78..67e8b446905 100644 --- a/usr.bin/tmux/cmd-run-shell.c +++ b/usr.bin/tmux/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.71 2021/03/02 10:56:45 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.72 2021/03/15 13:06:33 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -20,6 +20,7 @@ #include <sys/types.h> #include <sys/wait.h> +#include <ctype.h> #include <stdlib.h> #include <string.h> @@ -190,8 +191,12 @@ cmd_run_shell_timer(__unused int fd, __unused short events, void* arg) &error); } if (status == CMD_PARSE_ERROR) { - cmdq_error(cdata->item, "%s", error); - free(error); + if (cdata->item == NULL) { + *error = toupper((u_char)*error); + status_message_set(c, -1, 1, "%s", error); + } else + cmdq_error(cdata->item, "%s", error); + free(error); } } |