diff --git a/src/3proxy.c b/src/3proxy.c index c6600e2..3ab75d7 100644 --- a/src/3proxy.c +++ b/src/3proxy.c @@ -467,6 +467,11 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nsopen(); /* before a chroot in the configuration takes /proc away */ #endif loginit(); /* standard output and error, syslog, before a chroot too */ +#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 #if defined _WIN32 && !defined _WINCE if(service) logstdclose(); #endif @@ -546,7 +551,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 74f272e..bf00a3c 100644 --- a/src/proxymain.c +++ b/src/proxymain.c @@ -220,6 +220,10 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int #endif _3proxy_mutex_init(&tpool.mutex); loginit(); +#ifndef _WIN32 + /* 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; /* errors go to the service's log once there is no standard error */