diff options
| author | Roy Marples <roy@marples.name> | 2007-10-11 13:19:25 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2007-10-11 13:19:25 +0000 |
| commit | 9f592213986cc935201390663de319ba783f0051 (patch) | |
| tree | 8a9cf5d4713091f67937edc7d6be18a99520b25b /signals.c | |
| parent | 8b67eaba15ceefc46412b6ea2bf50a0dbc384d3a (diff) | |
| download | dhcpcd-9f592213986cc935201390663de319ba783f0051.tar.xz | |
Allow none signal pipe users to grab signals
Diffstat (limited to 'signals.c')
| -rw-r--r-- | signals.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -33,6 +33,7 @@ #include "signals.h" static int signal_pipe[2]; +static int signal_signal = 0; static void signal_handler (int sig) { @@ -44,6 +45,7 @@ static void signal_handler (int sig) return; } + signal_signal = sig; if (send (signal_pipe[1], &sig, sizeof (sig), MSG_DONTWAIT) == -1) logger (LOG_ERR, "Could not send signal: %s", strerror (errno)); } @@ -89,9 +91,12 @@ int signal_read (const fd_set *rfds) { int sig; - if (! FD_ISSET (signal_pipe[0], rfds)) - return 0; + if (signal_signal) + return signal_signal; + if (! rfds || ! FD_ISSET (signal_pipe[0], rfds)) + return -1; + if (read (signal_pipe[0], &sig, sizeof (sig)) == -1) return -1; |
