Help: /bin/ping problem with Red Hat

Jeff Epler jepler at
Wed Mar 12 17:32:25 CET 2003

system(), spawn*() and/or fork+exec from a Python thread on Linux tends to do
strange things.  I believe it has to do with changes to signal handling
done by linux pthreads implementation which are not undone when a new
process is exec()'d.

The following program sets all signals back to the default and then
executes the given program.  Using a wrapper like this might let the
system()'d program execute properly (system("xxx") becomes system("rehup

#include <signal.h>

int main(int c, char **v) {
    int i;
    sigset_t sset;

    if (sigprocmask(SIG_SETMASK, &sset, 0) == -1) perror("sigprocmask");
    for(i=0; i<32; i++) {
	if(signal(i, SIG_DFL) == SIG_ERR) perror("signal");
    execv(v[1], &v[1]);
    return 1;

More information about the Python-list mailing list