wget: -O FILE is allowed to overwrite existing file (compat)
[oweals/busybox.git] / networking / dnsd.c
index c9c7b3a7c4f5ce664e8134608fb2758f07537a74..c906de32a2dba1953a5b2906c775de94d6d2bf91 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #include <syslog.h>
-#include "busybox.h"
+#include "libbb.h"
 
 //#define DEBUG 1
 #define DEBUG 0
@@ -338,7 +338,7 @@ int dnsd_main(int argc, char **argv)
        uint16_t port = 53;
        uint8_t buf[MAX_PACK_LEN];
 
-       getopt32(argc, argv, "i:c:t:p:dv", &listen_interface, &fileconf, &sttl, &sport);
+       getopt32(argv, "i:c:t:p:dv", &listen_interface, &fileconf, &sttl, &sport);
        //if (option_mask32 & 0x1) // -i
        //if (option_mask32 & 0x2) // -c
        if (option_mask32 & 0x4) // -t
@@ -353,12 +353,7 @@ int dnsd_main(int argc, char **argv)
        }
 
        if (OPT_daemon) {
-#ifdef BB_NOMMU
-               if (!re_execed)
-                       vfork_daemon_rexec(1, 0, argv);
-#else
-               xdaemon(1, 0);
-#endif
+               bb_daemonize_or_rexec(DAEMON_CLOSE_EXTRA_FDS, argv);
                openlog(applet_name, LOG_PID, LOG_DAEMON);
                logmode = LOGMODE_SYSLOG;
        }
@@ -380,7 +375,7 @@ int dnsd_main(int argc, char **argv)
        xbind(udps, &lsa->sa, lsa->len);
        /* xlisten(udps, 50); - ?!! DGRAM sockets are never listened on I think? */
        bb_info_msg("Accepting UDP packets on %s",
-                       xmalloc_sockaddr2dotted(&lsa->sa, lsa->len));
+                       xmalloc_sockaddr2dotted(&lsa->sa));
 
        while (1) {
                int r;