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 13:31:00 +0200
commitb02e1b84803701d7bd65550f5435655696646b37 (patch)
treef187b1991c830df740c76dd758b4b8f2f8c521f4
parent787b261ffa5a1abca76b6ca4f8cc38373b9ccc2c (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;