aboutsummaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/client.c b/client.c
index 6ab53e4f..48cce926 100644
--- a/client.c
+++ b/client.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <event.h>
#include <fcntl.h>
+#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -437,15 +438,11 @@ client_signal(int sig, unused short events, unused void *data)
struct sigaction sigact;
int status;
- if (!client_attached) {
- switch (sig) {
- case SIGCHLD:
- waitpid(WAIT_ANY, &status, WNOHANG);
- break;
- case SIGTERM:
+ if (sig == SIGCHLD)
+ waitpid(WAIT_ANY, &status, WNOHANG);
+ else if (!client_attached) {
+ if (sig == SIGTERM)
event_loopexit(NULL);
- break;
- }
} else {
switch (sig) {
case SIGHUP: