aboutsummaryrefslogtreecommitdiffstats
path: root/src/satd.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-25 17:15:03 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-25 17:15:03 +0100
commitd7dd2d885c3dc8711c04f564b06169bc1ccefe1d (patch)
tree22fcf13f1f920985f84bdad93a02060144f4323d /src/satd.c
parentsatd: command line (diff)
downloadsat-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.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/satd.c b/src/satd.c
index 4534ae4..db9cc4b 100644
--- a/src/satd.c
+++ b/src/satd.c
@@ -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;
}