summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarell Tan <darell.tan@gmail.com>2011-01-02 02:39:08 +0800
committerDarell Tan <darell.tan@gmail.com>2011-01-02 02:39:08 +0800
commit60a6c72901bcfdcbee9aed0b507b6328f7293a6e (patch)
treeb1a6e7ea9ceebcf19dd53f1ac2a0d9dfd26d028b
parent244ad56cf6714daba50c61a10201a60b77ae74cb (diff)
downloadmdns-repeater-60a6c72901bcfdcbee9aed0b507b6328f7293a6e.tar.gz
mdns-repeater-60a6c72901bcfdcbee9aed0b507b6328f7293a6e.zip
Bugfix: daemonize() should be called before sockets are opened.
-rw-r--r--mdns-repeater.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mdns-repeater.c b/mdns-repeater.c
index f06720b..af17dca 100644
--- a/mdns-repeater.c
+++ b/mdns-repeater.c
@@ -288,6 +288,8 @@ int main(int argc, char *argv[]) {
}
openlog(PACKAGE, LOG_PID | LOG_CONS, LOG_DAEMON);
+ if (! foreground)
+ daemonize();
// create receiving socket
server_sockfd = create_recv_sock();
@@ -313,9 +315,6 @@ int main(int argc, char *argv[]) {
return 1;
}
- if (! foreground)
- daemonize();
-
while (! shutdown_flag) {
struct timeval tv = {
.tv_sec = 10,