Move signal handler setup to main so it's only done once.

This commit is contained in:
Daniel O'Connor 2012-06-25 16:01:57 +09:30
parent 6a941cbc4d
commit 930280a17d
3 changed files with 4 additions and 6 deletions

4
main.c
View File

@ -25,6 +25,10 @@ int main(int argc, char **argv)
WSADATA wsa_data;
WSAStartup(MAKEWORD(1,1), &wsa_data);
#endif
/* Setup signal handlers */
signal(SIGPIPE,sigPipeHandler);
signal(SIGIO,sigIoHandler);
memabuseInit();
srandomdev();
server_save_argv(argc, (const char*const*)argv);

View File

@ -74,8 +74,6 @@ int monitor_setup_sockets()
if (monitor_named_socket!=-1)
return 0;
/* ignore SIGPIPE so that we don't explode */
signal(SIGPIPE, SIG_IGN);
if ((monitor_named_socket = socket(AF_UNIX, SOCK_STREAM, 0))==-1) {
WHY_perror("socket");
goto error;

View File

@ -72,10 +72,6 @@ int rhizome_server_start()
if (debug&DEBUG_RHIZOME) WHYF("Trying to start rhizome server.");
/* Catch broken pipe signals */
signal(SIGPIPE,sigPipeHandler);
signal(SIGIO,sigIoHandler);
rhizome_server_socket=socket(AF_INET,SOCK_STREAM,0);
if (rhizome_server_socket<0)
{