From 6a8e2a99cbfb1544e6b79f2e58697a44cfe4ec73 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 9 Oct 2005 10:05:21 +0200 Subject: [PATCH] Now using daemon() instead of fork() to run VDR in daemon mode --- CONTRIBUTORS | 3 +++ HISTORY | 3 ++- vdr.c | 10 ++-------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 59758469..c8e27dd4 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1505,3 +1505,6 @@ Alexander Rieger Philip Prindeville for updates to 'sources.conf' + +Enrico Scholz + for making VDR use use daemon() instead of fork() to run in daemon mode diff --git a/HISTORY b/HISTORY index fc46afb1..25bc5243 100644 --- a/HISTORY +++ b/HISTORY @@ -3886,6 +3886,7 @@ Video Disk Recorder Revision History - The 'sub-title' and 'bottom text' in the CAM menu can now consist of several lines. - Improved the CAM enquiry menu. -2005-10-08: Version 1.3.35 +2005-10-09: Version 1.3.35 - Updated 'sources.conf' (thanks to Philip Prindeville). +- Now using daemon() instead of fork() to run VDR in daemon mode (thanks to Enrico Scholz). 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 @@ -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