Skip to content

Commit

Permalink
Restore default SIGCHLD handler for spawned processes
Browse files Browse the repository at this point in the history
Examples of software expecting SIGCHLD not to be ignored at startup are:
- /sbin/ifup & /sbin/ifdown (Debian)
- 'subprocess' module of Python
  • Loading branch information
jmuchemb authored and wertarbyte committed May 24, 2011
1 parent 649bf67 commit 3e8f7eb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <string.h>
#include <ctype.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand Down Expand Up @@ -221,6 +222,10 @@ void run_triggers(int type, int code, int value, keystate_holder ksh, device *de
char ev[8];
sprintf( &(ev[0]), "%d", et->value );
setenv( "TH_VALUE", &(ev[0]), 1 );
/* default SIGCHLD is not automatically
restored and most applications would
fail if this signal is ignored */
signal(SIGCHLD, SIG_DFL);
system(et->action);
exit(0);
} else if (pid < 0) {
Expand Down

0 comments on commit 3e8f7eb

Please sign in to comment.