mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-21 14:07:53 +00:00
Move signal handler setup to main so it's only done once.
This commit is contained in:
parent
6a941cbc4d
commit
930280a17d
4
main.c
4
main.c
@ -25,6 +25,10 @@ int main(int argc, char **argv)
|
|||||||
WSADATA wsa_data;
|
WSADATA wsa_data;
|
||||||
WSAStartup(MAKEWORD(1,1), &wsa_data);
|
WSAStartup(MAKEWORD(1,1), &wsa_data);
|
||||||
#endif
|
#endif
|
||||||
|
/* Setup signal handlers */
|
||||||
|
signal(SIGPIPE,sigPipeHandler);
|
||||||
|
signal(SIGIO,sigIoHandler);
|
||||||
|
|
||||||
memabuseInit();
|
memabuseInit();
|
||||||
srandomdev();
|
srandomdev();
|
||||||
server_save_argv(argc, (const char*const*)argv);
|
server_save_argv(argc, (const char*const*)argv);
|
||||||
|
@ -74,8 +74,6 @@ int monitor_setup_sockets()
|
|||||||
if (monitor_named_socket!=-1)
|
if (monitor_named_socket!=-1)
|
||||||
return 0;
|
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) {
|
if ((monitor_named_socket = socket(AF_UNIX, SOCK_STREAM, 0))==-1) {
|
||||||
WHY_perror("socket");
|
WHY_perror("socket");
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -72,10 +72,6 @@ int rhizome_server_start()
|
|||||||
|
|
||||||
if (debug&DEBUG_RHIZOME) WHYF("Trying to start rhizome server.");
|
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);
|
rhizome_server_socket=socket(AF_INET,SOCK_STREAM,0);
|
||||||
if (rhizome_server_socket<0)
|
if (rhizome_server_socket<0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user