summaryrefslogtreecommitdiffstats
path: root/lib/libevent
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2005-12-02 16:54:25 +0000
committerderaadt <deraadt@openbsd.org>2005-12-02 16:54:25 +0000
commit6d3295f7cc871b09c6a89ca29320bfee24951d28 (patch)
tree9e19ec13006fa1c37932bd6304298bf8a8ac31a4 /lib/libevent
parentunlink() pid file on exit. ok deraadt@ (diff)
downloadwireguard-openbsd-6d3295f7cc871b09c6a89ca29320bfee24951d28.tar.xz
wireguard-openbsd-6d3295f7cc871b09c6a89ca29320bfee24951d28.zip
make write-end of signal socketpair non-blocking.
every signal received writes 1 byte to the socketpair. if you are outside the libevent main loop too long, the socketpair might fill up. that write would then block, in a signal handler. related to this, yesterdy we changed the signal handler to not trash errno. as for the read end, there will be multiple libevent reads off the socketpair (100 bytes at a time) until the socketpair is empty again ok provos
Diffstat (limited to 'lib/libevent')
-rw-r--r--lib/libevent/signal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libevent/signal.c b/lib/libevent/signal.c
index 7488b390279..fa623a40c5d 100644
--- a/lib/libevent/signal.c
+++ b/lib/libevent/signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.c,v 1.9 2005/12/02 04:14:03 deraadt Exp $ */
+/* $OpenBSD: signal.c,v 1.10 2005/12/02 16:54:25 deraadt Exp $ */
/*
* Copyright 2000-2002 Niels Provos <provos@citi.umich.edu>
@@ -101,6 +101,8 @@ evsignal_init(sigset_t *evsigmask)
FD_CLOSEONEXEC(ev_signal_pair[0]);
FD_CLOSEONEXEC(ev_signal_pair[1]);
+ fcntl(ev_signal_pair[0], F_SETFL, O_NONBLOCK);
+
event_set(&ev_signal, ev_signal_pair[1], EV_READ,
evsignal_cb, &ev_signal);
ev_signal.ev_flags |= EVLIST_INTERNAL;