]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
gui: Check return value of para_exec_cmdline_pid().
authorAndre Noll <maan@systemlinux.org>
Tue, 13 Mar 2012 21:30:34 +0000 (22:30 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 18 Mar 2012 20:08:36 +0000 (21:08 +0100)
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

diff --git a/gui.c b/gui.c
index 48d4b51b6445c902a791755cc84737f3421dafc7..2ed66be7b2f4efaec7ebf4dacc6f72039a529daa 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -1112,7 +1112,8 @@ static void external_cmd(char *cmd)
        if (cmd_pid)
                return;
        shutdown_curses();
        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();
        cmd_died = 0;
        do_select(EXTERNAL_MODE);
        init_curses();