diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-10-21 18:46:44 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-10-21 18:46:44 +0200 |
commit | ce931b0a5e1a6a4045d7c30c5d877488907dc87d (patch) | |
tree | a267caa0b974afd0fc57debad5fce11f98edad85 | |
parent | b739ed0e09a640d0fd1c386f24ea2df580a410ed (diff) | |
parent | b02e1b84803701d7bd65550f5435655696646b37 (diff) | |
download | platform_external_libdaemon-ce931b0a5e1a6a4045d7c30c5d877488907dc87d.tar.gz platform_external_libdaemon-ce931b0a5e1a6a4045d7c30c5d877488907dc87d.tar.bz2 platform_external_libdaemon-ce931b0a5e1a6a4045d7c30c5d877488907dc87d.zip |
Merge commit 'flameeyes/opensolaris'
-rw-r--r-- | libdaemon/dfork.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libdaemon/dfork.c b/libdaemon/dfork.c index f1ba7c1..62469bb 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) { @@ -228,7 +236,9 @@ pid_t daemon_fork(void) { goto fail; } else if (pid == 0) { +#ifdef TIOCNOTTY int tty_fd; +#endif /* Second child */ if (sigaction(SIGCHLD, &sa_old, NULL) < 0) { @@ -470,9 +480,9 @@ int daemon_close_all(int except_fd, ...) { int daemon_close_allv(const int except_fds[]) { struct rlimit rl; int fd; - int saved_errno; #ifdef __linux__ + int saved_errno; DIR *d; @@ -665,7 +675,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) { |