summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-10-01 13:26:32 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-10-01 21:52:56 +0200
commit5b1daf072556c1fc9a00e8735fa0cdba280c2231 (patch)
tree1b7d9e2f88f19133531bdecf4d250da01518f6ea
parentb739ed0e09a640d0fd1c386f24ea2df580a410ed (diff)
Fix building on OpenSolaris (without _NSIG definition).
On OpenSolaris, the _NSIG macro is not defined, but NSIG is; as it's not possible to use NSIG under glibc (it would miss the SIGRT* series), define a SIGNAL_UPPER_BOUND depending on the system (and error out if the system lacks both NSIG and _NSIG).
-rw-r--r--libdaemon/dfork.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libdaemon/dfork.c b/libdaemon/dfork.c
index f1ba7c1..6b94944 100644
--- a/libdaemon/dfork.c
+++ b/libdaemon/dfork.c
@@ -42,6 +42,14 @@
#include "dnonblock.h"
#include "dlog.h"
+#if defined(_NSIG) /* On glibc NSIG does not count RT signals */
+# define SIGNAL_UPPER_BOUND _NSIG
+#elif defined(NSIG) /* Solaris defines just this */
+# define SIGNAL_UPPER_BOUND NSIG
+#else
+# error "Unknown upper bound for signals"
+#endif
+
static int _daemon_retval_pipe[2] = { -1, -1 };
static int _null_open(int f, int fd) {
@@ -665,7 +673,7 @@ int daemon_reset_sigs(int except, ...) {
int daemon_reset_sigsv(const int except[]) {
int sig;
- for (sig = 1; sig < _NSIG; sig++) {
+ for (sig = 1; sig < SIGNAL_UPPER_BOUND; sig++) {
int reset = 1;
switch (sig) {