Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: third_party/libevent/signal.c

Issue 412006: posix: upgrade libevent from 1.4.7 to 1.4.13 (Closed)
Patch Set: better readme Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
}

Powered by Google App Engine
This is Rietveld 408576698