Now using daemon() instead of fork() to run VDR in daemon mode

This commit is contained in:
Klaus Schmidinger 2005-10-09 10:05:21 +02:00
parent e83482945d
commit 6a8e2a99cb
3 changed files with 7 additions and 9 deletions

View File

@ -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

View File

@ -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).

10
vdr.c
View File

@ -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