From: Lee Howard Date: Tue, 27 Sep 2005 19:03:11 +0000 (+0000) Subject: Bug 362: be more informative if there is a problem with /dev/null X-Git-Tag: HYLAFAX-4_2_3BETA1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb65de3cec6f699e8d2411972bf291a951addada;p=thirdparty%2FHylaFAX.git Bug 362: be more informative if there is a problem with /dev/null --- diff --git a/CHANGES b/CHANGES index ea1fd795..70a0c7e2 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ Changelog for HylaFAX +* be more informative with /dev/null errors (27 Sep 2005) * don't place a call if there are no documents (27 Sep 2005) * make hfaxd clean up after itself (27 Sep 2005) * add xferfaxlog accounting for jobs that time out (27 Sep 2005) diff --git a/faxd/faxApp.c++ b/faxd/faxApp.c++ index da3ca367..87e161e7 100644 --- a/faxd/faxApp.c++ +++ b/faxd/faxApp.c++ @@ -357,6 +357,8 @@ detachIO(void) endpwent(); // XXX some systems hold descriptors closelog(); // XXX in case syslog has descriptor int fd = Sys::open(_PATH_DEVNULL, O_RDWR); + if (fd == -1) + printf("Could not open null device file %s.", _PATH_DEVNULL); dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); @@ -464,6 +466,8 @@ faxApp::detachFromTTY(void) { #ifdef O_NOCTTY int fd = Sys::open(_PATH_DEVNULL, O_RDWR); + if (fd == -1) + printf("Could not open null device file %s.", _PATH_DEVNULL); dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); diff --git a/hfaxd/main.c++ b/hfaxd/main.c++ index 27d2bb43..42303a20 100644 --- a/hfaxd/main.c++ +++ b/hfaxd/main.c++ @@ -160,6 +160,8 @@ static void detachFromTTY(void) { int fd = Sys::open(_PATH_DEVNULL, O_RDWR); + if (fd == -1) + fatal("Could not open null device file %s.", _PATH_DEVNULL); dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO);