diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-02-18 14:48:04 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-02-18 14:48:04 +0100 |
commit | cbc11436c4349e582f1bbdafa0446d232de24e22 (patch) | |
tree | da660c1417c95462b22d75574bb94e96a640a94b /llmnrd.c | |
parent | 5d194a8dabbd5ca8e48db5c330ff4c69e579da83 (diff) |
llmnrd: Support daemonization
No logging to syslog or dropping of privileges etc yet.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'llmnrd.c')
-rw-r--r-- | llmnrd.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -18,6 +18,7 @@ * along with llmnrd. If not, see <http://www.gnu.org/licenses/>. */ +#include <errno.h> #include <getopt.h> #include <signal.h> #include <stdbool.h> @@ -149,7 +150,10 @@ int main(int argc, char **argv) } if (daemonize) { - /* TODO */ + if (daemon(0, 0) != 0) { + log_err("Failed to daemonize process: %s\n", strerror(errno)); + return EXIT_FAILURE; + } } if (iface_start_thread() < 0) |