diff --git a/src/3proxy.c b/src/3proxy.c index c2a7ce0..1f6d41e 100644 --- a/src/3proxy.c +++ b/src/3proxy.c @@ -549,6 +549,11 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int return 1; } +#ifndef _WIN32 + /* before readconfig() starts the services: a client gone while it is + written to is an error, not the end */ + signal(SIGPIPE, SIG_IGN); +#endif _3proxy_mutex_init(&config_mutex); _3proxy_mutex_init(&runningservices_mutex); _3proxy_mutex_init(&bandlim_mutex); @@ -608,7 +613,6 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int signal(SIGCONT, mysigpause); signal(SIGTERM, mysigterm); signal(SIGUSR1, mysigusr1); - signal(SIGPIPE, SIG_IGN); cyclestep(); #endif diff --git a/src/proxymain.c b/src/proxymain.c index d7ba248..9b84206 100644 --- a/src/proxymain.c +++ b/src/proxymain.c @@ -1336,6 +1336,9 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int WSADATA wd; WSAStartup(MAKEWORD( 1, 1 ), &wd); +#else + /* a client gone while it is written to is an error, not the end */ + signal(SIGPIPE, SIG_IGN); #endif if((res = srvprepare(&s, argc, argv))) return res;