aboutsummaryrefslogtreecommitdiffstats
path: root/signals.c
diff options
context:
space:
mode:
Diffstat (limited to 'signals.c')
-rw-r--r--signals.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/signals.c b/signals.c
index 6576afd..fd3b0c3 100644
--- a/signals.c
+++ b/signals.c
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
- * Copyright 2006-2008 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2009 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -40,10 +40,12 @@
static int signal_pipe[2];
static const int handle_sigs[] = {
- SIGHUP,
SIGALRM,
+ SIGHUP,
+ SIGINT,
+ SIGPIPE,
SIGTERM,
- SIGINT
+ SIGUSR1,
};
static void
@@ -52,17 +54,11 @@ signal_handler(int sig)
int serrno = errno;
if (write(signal_pipe[1], &sig, sizeof(sig)) != sizeof(sig))
- syslog(LOG_ERR, "write signal %d: %s", sig, strerror(errno));
+ syslog(LOG_ERR, "failed to write signal %d: %m", sig);
/* Restore errno */
errno = serrno;
}
-int
-signal_fd(void)
-{
- return (signal_pipe[0]);
-}
-
/* Read a signal from the signal pipe. Returns 0 if there is
* no signal, -1 on error (and sets errno appropriately), and
* your signal on success */
@@ -95,7 +91,7 @@ signal_init(void)
return -1;
if (set_cloexec(signal_pipe[1]) == -1)
return -1;
- return 0;
+ return signal_pipe[0];
}
static int
@@ -125,3 +121,4 @@ signal_reset(void)
{
return signal_handle(SIG_DFL);
}
+