Most of the code checks for pager_process.pid != 0 to see if a pager is
running. If fork fails and returns -1, pager_process.pid is not 0, too.
This in turn leads to an issue if waitpid is eventually called with -1
as pid, which would wait for all children. Since there are no children,
the wait_for_pager function calls err with an EXIT_FAILURE value.
Properly handle a potential fork error.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
}
if (cmd->pid < 0) {
+ cmd->pid = 0;
close_pair(fdin);
return -1;
}