swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit ee0825dd7b49a5ac65d5e94bdad159ca77481bc1
parent 40a3700a99902e984c73450326057a3c6d9833d7
Author: Michael Forney <mforney@mforney.org>
Date:   Mon, 24 Oct 2016 02:04:29 -0700

launch: Handle SIGCHLD during posix_spawn call

Diffstat:
Mlaunch/launch.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/launch/launch.c b/launch/launch.c @@ -130,7 +130,8 @@ cleanup(void) stop_devices(false); ioctl(launcher.tty_fd, VT_ACTIVATE, original_vt_state.vt); - kill(child_pid, SIGTERM); + if (child_pid) + kill(child_pid, SIGTERM); } void __attribute__((noreturn, format(printf, 1, 2))) @@ -144,12 +145,9 @@ die(const char *format, ...) if (format[0] && format[strlen(format) - 1] == ':') fprintf(stderr, " %s", strerror(errno)); - fputc('\n', stderr); - if (child_pid) - cleanup(); - + cleanup(); exit(EXIT_FAILURE); } @@ -178,6 +176,8 @@ handle_chld(int signal) { int status; + if (!child_pid) + return; wait(&status); cleanup(); exit(WEXITSTATUS(status));