From d0d27cfa56d05eaa0e5567c75adfe606eab2957e Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 13 Mar 2012 22:30:34 +0100 Subject: [PATCH] gui: Check return value of para_exec_cmdline_pid(). external_cmd() calls this function to execute the given command. However, as para_exec_cmdline_pid() may fail, e.g. because the underlying call to fork() failed due to hitting the RLIMIT_NPROC resource limit, we must check the return value. The other two command dispatchers got this right, but external_cmd() did not. --- gui.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui.c b/gui.c index 48d4b51b..2ed66be7 100644 --- a/gui.c +++ b/gui.c @@ -1112,7 +1112,8 @@ static void external_cmd(char *cmd) if (cmd_pid) return; shutdown_curses(); - para_exec_cmdline_pid(&cmd_pid, cmd, fds); + if (para_exec_cmdline_pid(&cmd_pid, cmd, fds) < 0) + return; cmd_died = 0; do_select(EXTERNAL_MODE); init_curses(); -- 2.39.5