aboutsummaryrefslogtreecommitdiffstats
path: root/src/satd.c
diff options
context:
space:
mode:
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;
}