summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-10-01 13:31:00 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-10-01 21:52:56 +0200
commit354715db707564693698ebac1ef63aa6c4e13e77 (patch)
treea267caa0b974afd0fc57debad5fce11f98edad85
parent5b1daf072556c1fc9a00e8735fa0cdba280c2231 (diff)
Conditionally declare variables if their use is conditional.
Reduces warnings about unused variables by not declaring them if they are under an #ifdef conditional.
-rw-r--r--libdaemon/dfork.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libdaemon/dfork.c b/libdaemon/dfork.c
index 6b94944..62469bb 100644
--- a/libdaemon/dfork.c
+++ b/libdaemon/dfork.c
@@ -236,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) {
@@ -478,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;