commit a535648447fb301dd2c89e79fb8e96db3fac984b
parent 8170f898519ea02c946d859157871be61c2a54a7
Author: sin <sin@2f30.org>
Date: Wed, 30 Mar 2016 13:32:06 +0100
only daemonize when in background
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/stun.c b/stun.c
@@ -797,8 +797,10 @@ main(int argc, char *argv[])
usage();
signal(SIGPIPE, SIG_IGN);
- daemon(0, 0);
- openlog("stun", LOG_PID | LOG_NDELAY, LOG_DAEMON);
+ if (!foreground) {
+ daemon(0, 0);
+ openlog("stun", LOG_PID | LOG_NDELAY, LOG_DAEMON);
+ }
devfd = opendev(argv[0]);