]> granicus.if.org Git - libevent/commitdiff
le-proxy: ignore SIGPIPE
authorAzat Khuzhin <azat@libevent.org>
Wed, 22 Jul 2020 21:28:09 +0000 (00:28 +0300)
committerAzat Khuzhin <azat@libevent.org>
Wed, 22 Jul 2020 21:28:09 +0000 (00:28 +0300)
Fixes: #1057
sample/le-proxy.c

index 13e0e2aea9181d96a793eba4e64c7d28a6714e9d..d46a5e15974f981c14581930c12903749f4e808d 100644 (file)
@@ -22,6 +22,7 @@
 #else
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <signal.h>
 #endif
 
 #include <event2/bufferevent_ssl.h>
@@ -217,10 +218,17 @@ main(int argc, char **argv)
        struct evconnlistener *listener;
 
 #ifdef _WIN32
-       WORD wVersionRequested;
-       WSADATA wsaData;
-       wVersionRequested = MAKEWORD(2, 2);
-       (void) WSAStartup(wVersionRequested, &wsaData);
+       {
+               WORD wVersionRequested;
+               WSADATA wsaData;
+               wVersionRequested = MAKEWORD(2, 2);
+               (void) WSAStartup(wVersionRequested, &wsaData);
+       }
+#else
+       if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
+               perror("signal()");
+               return 1;
+       }
 #endif
 
        if (argc < 3)