X-Git-Url: https://ruderich.org/simon/gitweb/?p=ptyas%2Fptyas.git;a=blobdiff_plain;f=ptyas.c;h=2cd0cd62ac575974b6cf253f28a21cf8231cccc0;hp=4b7b208856e88f53a43abc833ea4dde6a7c5bcdb;hb=00fc37e8084778674d5c8d5bd48f26177ad17817;hpb=a39434b70dfe6428b3c8ef5061b6f0a1475974b5 diff --git a/ptyas.c b/ptyas.c index 4b7b208..2cd0cd6 100644 --- a/ptyas.c +++ b/ptyas.c @@ -270,10 +270,12 @@ static void proxy_input_between_ttys(int pty_master, int ctty, volatile pid_t *p static volatile pid_t pid_to_wait_for; static int pid_to_wait_for_status; -static void sigchld_handler() { +static void sigchld_handler(int signal) { int status; pid_t pid; + (void)signal; + while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { if (pid == pid_to_wait_for) { /* Mark that our child has died and we should exit as well. */ @@ -426,6 +428,7 @@ int main(int argc, char **argv) { struct sigaction action = { .sa_handler = sigchld_handler, }; + sigemptyset(&action.sa_mask); if (sigaction(SIGCHLD, &action, NULL) != 0) { die("sigaction"); }