diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-25 17:15:03 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-25 17:15:03 +0100 |
commit | d7dd2d885c3dc8711c04f564b06169bc1ccefe1d (patch) | |
tree | 22fcf13f1f920985f84bdad93a02060144f4323d /src/satd.c | |
parent | satd: command line (diff) | |
download | sat-d7dd2d885c3dc8711c04f564b06169bc1ccefe1d.tar.gz sat-d7dd2d885c3dc8711c04f564b06169bc1ccefe1d.tar.bz2 sat-d7dd2d885c3dc8711c04f564b06169bc1ccefe1d.tar.xz |
daemonise
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r-- | src/satd.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -23,6 +23,8 @@ #include <stdlib.h> #include <string.h> +#include "daemonise.h" + /** @@ -59,6 +61,15 @@ main(int argc, char *argv[]) foreground = 1; } - /* TODO guess what, this is going to be the daemon */ + if (foreground ? 0 : daemonise(0)) + goto fail; + + undaemonise(); + return 0; + +fail: + perror(argv0); + undaemonise(); + return 1; } |