| Index: third_party/libevent/signal.c
|
| diff --git a/third_party/libevent/signal.c b/third_party/libevent/signal.c
|
| index bcaa3f9b5f3dff9fb26073d9e44e447d48aa97ab..74fa23f688aba29aad777e2ead99933b9b2ce869 100644
|
| --- a/third_party/libevent/signal.c
|
| +++ b/third_party/libevent/signal.c
|
| @@ -71,7 +71,7 @@ static void evsignal_handler(int sig);
|
| static void
|
| evsignal_cb(int fd, short what, void *arg)
|
| {
|
| - static char signals[100];
|
| + static char signals[1];
|
| #ifdef WIN32
|
| SSIZE_T n;
|
| #else
|
| @@ -92,7 +92,7 @@ evsignal_cb(int fd, short what, void *arg)
|
| #define FD_CLOSEONEXEC(x)
|
| #endif
|
|
|
| -void
|
| +int
|
| evsignal_init(struct event_base *base)
|
| {
|
| int i;
|
| @@ -103,8 +103,16 @@ evsignal_init(struct event_base *base)
|
| * signals that got delivered.
|
| */
|
| if (evutil_socketpair(
|
| - AF_UNIX, SOCK_STREAM, 0, base->sig.ev_signal_pair) == -1)
|
| + AF_UNIX, SOCK_STREAM, 0, base->sig.ev_signal_pair) == -1) {
|
| +#ifdef WIN32
|
| + /* Make this nonfatal on win32, where sometimes people
|
| + have localhost firewalled. */
|
| + event_warn("%s: socketpair", __func__);
|
| +#else
|
| event_err(1, "%s: socketpair", __func__);
|
| +#endif
|
| + return -1;
|
| + }
|
|
|
| FD_CLOSEONEXEC(base->sig.ev_signal_pair[0]);
|
| FD_CLOSEONEXEC(base->sig.ev_signal_pair[1]);
|
| @@ -122,6 +130,8 @@ evsignal_init(struct event_base *base)
|
| EV_READ | EV_PERSIST, evsignal_cb, &base->sig.ev_signal);
|
| base->sig.ev_signal.ev_base = base;
|
| base->sig.ev_signal.ev_flags |= EVLIST_INTERNAL;
|
| +
|
| + return 0;
|
| }
|
|
|
| /* Helper: set the signal handler for evsignal to handler in base, so that
|
| @@ -310,6 +320,7 @@ evsignal_process(struct event_base *base)
|
| ncalls = sig->evsigcaught[i];
|
| if (ncalls == 0)
|
| continue;
|
| + sig->evsigcaught[i] -= ncalls;
|
|
|
| for (ev = TAILQ_FIRST(&sig->evsigevents[i]);
|
| ev != NULL; ev = next_ev) {
|
| @@ -319,7 +330,6 @@ evsignal_process(struct event_base *base)
|
| event_active(ev, EV_SIGNAL, ncalls);
|
| }
|
|
|
| - sig->evsigcaught[i] = 0;
|
| }
|
| }
|
|
|
|
|