summaryrefslogtreecommitdiff
path: root/vdr.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-10-09 10:05:21 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-10-09 10:05:21 +0200
commit6a8e2a99cbfb1544e6b79f2e58697a44cfe4ec73 (patch)
tree6ea92767eb56eca7ab99fadd67739f34b420ab42 /vdr.c
parente83482945d34cf956599b3728b0bd413cad3cdc4 (diff)
downloadvdr-6a8e2a99cbfb1544e6b79f2e58697a44cfe4ec73.tar.gz
vdr-6a8e2a99cbfb1544e6b79f2e58697a44cfe4ec73.tar.bz2
Now using daemon() instead of fork() to run VDR in daemon mode
Diffstat (limited to 'vdr.c')
-rw-r--r--vdr.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/vdr.c b/vdr.c
index 0fab1899..9d84d84e 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/vdr
*
- * $Id: vdr.c 1.217 2005/09/24 13:27:26 kls Exp $
+ * $Id: vdr.c 1.218 2005/10/09 10:01:45 kls Exp $
*/
#include <getopt.h>
@@ -370,17 +370,11 @@ int main(int argc, char *argv[])
// Daemon mode:
if (DaemonMode) {
- pid_t pid = fork();
- if (pid < 0) {
+ if (daemon(1, 0) == -1) {
fprintf(stderr, "%m\n");
esyslog("ERROR: %m");
return 2;
}
- if (pid != 0)
- return 0; // initial program immediately returns
- fclose(stdin);
- fclose(stdout);
- fclose(stderr);
}
else if (Terminal) {
// Claim new controlling terminal