From 3636345a25646c407b07af7679f37a2f8708e1e9 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 20 Jun 2009 16:17:00 +0000 Subject: [PATCH] 2009-06-21 Tatsuhiro Tsujikawa Call daemon() with arguments(0,0), which means daemon() changes current working directory to / and redirects stdin, stdout and stderr to /dev/null. * src/option_processing.cc --- ChangeLog | 7 +++++++ src/option_processing.cc | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9280c92c..0cc22bc8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-06-21 Tatsuhiro Tsujikawa + + Call daemon() with arguments(0,0), which means daemon() changes + current working directory to / and redirects stdin, stdout and + stderr to /dev/null. + * src/option_processing.cc + 2009-06-21 Tatsuhiro Tsujikawa Small performance optimizations. diff --git a/src/option_processing.cc b/src/option_processing.cc index 713251be..14613c80 100644 --- a/src/option_processing.cc +++ b/src/option_processing.cc @@ -191,7 +191,7 @@ void option_processing(Option& op, std::deque& uris, } #ifdef HAVE_DAEMON if(op.getAsBool(PREF_DAEMON)) { - if(daemon(1, 1) < 0) { + if(daemon(0, 0) < 0) { perror(MSG_DAEMON_FAILED); exit(DownloadResult::UNKNOWN_ERROR); }