From 354715db707564693698ebac1ef63aa6c4e13e77 Mon Sep 17 00:00:00 2001 From: Diego 'Flameeyes' Pettenò Date: Wed, 1 Oct 2008 13:31:00 +0200 Subject: Conditionally declare variables if their use is conditional. Reduces warnings about unused variables by not declaring them if they are under an #ifdef conditional. --- libdaemon/dfork.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- cgit