From 103295c769903abb519b9826cb4b60df7930efb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Gouget?= Date: Thu, 13 Jun 2002 21:57:38 +0000 Subject: [PATCH] Reset signals to SIG_DFL before starting a child process. --- dlls/ntdll/signal_i386.c | 5 +---- dlls/ntdll/signal_sparc.c | 5 ----- scheduler/client.c | 2 ++ scheduler/process.c | 5 +++++ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 199d845c1dd..767e98547ac 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -772,7 +772,7 @@ static void do_trap( CONTEXT *context, int trap_code ) } else { - /* likely we get this because of a kill(SIGTRAP) on ourself, + /* likely we get this because of a kill(SIGTRAP) on ourself, * so send a bp exception instead of a single step exception */ TRACE("Spurious single step trap => breakpoint simulation\n"); @@ -1059,9 +1059,6 @@ BOOL SIGNAL_Init(void) sigfillset( &all_sigs ); - /* automatic child reaping to avoid zombies */ - signal( SIGCHLD, SIG_IGN ); - if (set_handler( SIGINT, have_sigaltstack, (void (*)())int_handler ) == -1) goto error; if (set_handler( SIGFPE, have_sigaltstack, (void (*)())fpe_handler ) == -1) goto error; if (set_handler( SIGSEGV, have_sigaltstack, (void (*)())segv_handler ) == -1) goto error; diff --git a/dlls/ntdll/signal_sparc.c b/dlls/ntdll/signal_sparc.c index 5b021783f12..9b13268881d 100644 --- a/dlls/ntdll/signal_sparc.c +++ b/dlls/ntdll/signal_sparc.c @@ -362,11 +362,6 @@ void SIGNAL_Unblock( void ) */ BOOL SIGNAL_Init(void) { - /* ignore SIGPIPE so that WINSOCK can get a EPIPE error instead */ - signal( SIGPIPE, SIG_IGN ); - /* automatic child reaping to avoid zombies */ - signal( SIGCHLD, SIG_IGN ); - sigfillset( &all_sigs ); if (set_handler( SIGINT, (void (*)())int_handler ) == -1) goto error; diff --git a/scheduler/client.c b/scheduler/client.c index de1da8ced17..f8ac512c66c 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -677,6 +677,8 @@ void CLIENT_InitThread(void) /* ignore SIGPIPE so that we get a EPIPE error instead */ signal( SIGPIPE, SIG_IGN ); + /* automatic child reaping to avoid zombies */ + signal( SIGCHLD, SIG_IGN ); /* create the server->client communication pipes */ if (pipe( reply_pipe ) == -1) server_protocol_perror( "pipe" ); diff --git a/scheduler/process.c b/scheduler/process.c index 119cf9edb68..ffc3606ec74 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -861,6 +862,10 @@ static int fork_and_exec( const char *filename, char *cmdline, char **envp = build_envp( env, extra_env ); close( fd[0] ); + /* Reset signals that we previously set to SIG_IGN */ + signal( SIGPIPE, SIG_DFL ); + signal( SIGCHLD, SIG_DFL ); + if (newdir) chdir(newdir); if (argv && envp)