Reset signals to SIG_DFL before starting a child process.

This commit is contained in:
François Gouget 2002-06-13 21:57:38 +00:00 committed by Alexandre Julliard
parent b4d3cb599e
commit 103295c769
4 changed files with 8 additions and 9 deletions

View File

@ -1059,9 +1059,6 @@ BOOL SIGNAL_Init(void)
sigfillset( &all_sigs ); 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( SIGINT, have_sigaltstack, (void (*)())int_handler ) == -1) goto error;
if (set_handler( SIGFPE, have_sigaltstack, (void (*)())fpe_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; if (set_handler( SIGSEGV, have_sigaltstack, (void (*)())segv_handler ) == -1) goto error;

View File

@ -362,11 +362,6 @@ void SIGNAL_Unblock( void )
*/ */
BOOL SIGNAL_Init(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 ); sigfillset( &all_sigs );
if (set_handler( SIGINT, (void (*)())int_handler ) == -1) goto error; if (set_handler( SIGINT, (void (*)())int_handler ) == -1) goto error;

View File

@ -677,6 +677,8 @@ void CLIENT_InitThread(void)
/* ignore SIGPIPE so that we get a EPIPE error instead */ /* ignore SIGPIPE so that we get a EPIPE error instead */
signal( SIGPIPE, SIG_IGN ); signal( SIGPIPE, SIG_IGN );
/* automatic child reaping to avoid zombies */
signal( SIGCHLD, SIG_IGN );
/* create the server->client communication pipes */ /* create the server->client communication pipes */
if (pipe( reply_pipe ) == -1) server_protocol_perror( "pipe" ); if (pipe( reply_pipe ) == -1) server_protocol_perror( "pipe" );

View File

@ -25,6 +25,7 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -861,6 +862,10 @@ static int fork_and_exec( const char *filename, char *cmdline,
char **envp = build_envp( env, extra_env ); char **envp = build_envp( env, extra_env );
close( fd[0] ); 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 (newdir) chdir(newdir);
if (argv && envp) if (argv && envp)