From: Remi Gacogne Date: Mon, 26 Mar 2018 15:19:46 +0000 (+0200) Subject: dnsdist: Remove the --daemon option X-Git-Tag: dnsdist-1.3.0~20^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b82a127e4553c1840edc341d13ae30506a5dbc7e;p=pdns dnsdist: Remove the --daemon option We keep finding bugs with this option because we don't use it on a regular basis and most users run dnsdist under some kind of supervision anyway. --- diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index fe665e513..fbde95d87 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -723,41 +723,6 @@ shared_ptr roundrobin(const NumberedServerVector& servers, cons return (*res)[(counter++) % res->size()].second; } -static void writepid(string pidfile) { - if (!pidfile.empty()) { - // Clean up possible stale file - unlink(pidfile.c_str()); - - // Write the pidfile - ofstream of(pidfile.c_str()); - if (of) { - of << getpid(); - } else { - errlog("Unable to write PID-file to '%s'.", pidfile); - } - of.close(); - } -} - -static void daemonize(void) -{ - if(fork()) - _exit(0); // bye bye - /* We are child */ - - setsid(); - - int i=open("/dev/null",O_RDWR); /* open stdin */ - if(i < 0) - ; // L< createPoolIfNotExists(pools_t& pools, const string& poolName) @@ -2019,10 +1984,8 @@ struct vector locals; vector remotes; bool checkConfig{false}; - bool beDaemon{false}; bool beClient{false}; bool beSupervised{false}; - string pidfile; string command; string config; string uid; @@ -2034,8 +1997,8 @@ std::atomic g_configurationDone{false}; static void usage() { cout< vec; - std::string acls; - g_ACL.getLocal()->toStringVector(&vec); - for(const auto& s : vec) { - if (!acls.empty()) - acls += ", "; - acls += s; - } - infolog("ACL allowing queries from: %s", acls.c_str()); + vinfolog("Running in the foreground"); + warnlog("dnsdist %s comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it according to the terms of the GPL version 2", VERSION); + vector vec; + std::string acls; + g_ACL.getLocal()->toStringVector(&vec); + for(const auto& s : vec) { + if (!acls.empty()) + acls += ", "; + acls += s; } + infolog("ACL allowing queries from: %s", acls.c_str()); uid_t newgid=0; gid_t newuid=0; @@ -2662,7 +2608,7 @@ try thread healththread(healthChecksThread); - if(g_cmdLine.beDaemon || g_cmdLine.beSupervised) { + if(g_cmdLine.beSupervised) { #ifdef HAVE_SYSTEMD sd_notify(0, "READY=1"); #endif diff --git a/pdns/dnsdistdist/docs/manpages/dnsdist.1.rst b/pdns/dnsdistdist/docs/manpages/dnsdist.1.rst index 52c9fa1c7..fab321ff7 100644 --- a/pdns/dnsdistdist/docs/manpages/dnsdist.1.rst +++ b/pdns/dnsdistdist/docs/manpages/dnsdist.1.rst @@ -58,7 +58,6 @@ Options that is used on the server (set with **setKey()**). Note that this will leak the key into your shell's history. Only available when dnsdist is compiled with libsodium support. --d, --daemon Operate as a daemon. -e, --execute Connect to dnsdist and execute *command*. -h, --help Display a helpful message and exit. -l, --local
Bind to *address*, Supply as many addresses (using multiple @@ -68,9 +67,7 @@ Options run dnsdist inside a supervisor (use with e.g. systemd and daemontools). --disable-syslog Disable logging to syslog. Use this when running inside a supervisor - that handles logging (like systemd). Do not use in combination with - **--daemon**. --p, --pidfile Write a pidfile to *file*, works only with **--daemon**. + that handles logging (like systemd). -u, --uid Change the process user to *uid* after binding sockets. *uid* can be a name or number. -g, --gid Change the process group to *gid* after binding sockets. *gid* Can