summaryrefslogtreecommitdiff
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
parente83482945d34cf956599b3728b0bd413cad3cdc4 (diff)
downloadvdr-6a8e2a99cbfb1544e6b79f2e58697a44cfe4ec73.tar.gz
vdr-6a8e2a99cbfb1544e6b79f2e58697a44cfe4ec73.tar.bz2
Now using daemon() instead of fork() to run VDR in daemon mode
-rw-r--r--CONTRIBUTORS3
-rw-r--r--HISTORY3
-rw-r--r--vdr.c10
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 <Alexander.Rieger@inka.de>
Philip Prindeville <philipp_subx@redfish-solutions.com>
for updates to 'sources.conf'
+
+Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+ 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 <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