From 9b03470dfd865e5e68ca17f28f2b1ab31eb0a3cb Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Tue, 11 Dec 2018 20:30:00 -0500 Subject: [PATCH] Fix no-daemon mode forking dnsmasq and not logging no-daemon mode operates just like debug mode, but without the debug output, and dnsmasq is not in debug mode. Signed-off-by: Mcat12 --- args.c | 1 + dnsmasq_interface.c | 2 +- log.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/args.c b/args.c index b0054408..13b464a4 100644 --- a/args.c +++ b/args.c @@ -35,6 +35,7 @@ void parse_args(int argc, char* argv[]) strcmp(argv[i], "debug") == 0) { debug = true; + daemonmode = false; ok = true; // Replace "-k" by "-d" (debug mode implies nofork) diff --git a/dnsmasq_interface.c b/dnsmasq_interface.c index e5f53938..b806a1b8 100644 --- a/dnsmasq_interface.c +++ b/dnsmasq_interface.c @@ -863,7 +863,7 @@ pthread_t DNSclientthread; void FTL_fork_and_bind_sockets(struct passwd *ent_pw) { - if(!debug && daemonmode) + if(daemonmode) go_daemon(); else savepid(); diff --git a/log.c b/log.c index 41c0b810..83e73e11 100644 --- a/log.c +++ b/log.c @@ -71,7 +71,7 @@ void logg(const char *format, ...) get_timestr(timestring); // Print to stdout before writing to file - if(debug) + if(!daemonmode) { printf("[%s] ", timestring); va_start(args, format);