From 0922eb1ccb33983bd4ad2d5c38475d56e2e60137 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 17 Dec 1996 02:09:51 +0000 Subject: Use error() for messages almost everywhere. svn path=/trunk/; revision=636 --- daemon.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'daemon.c') diff --git a/daemon.c b/daemon.c index 0e48ffb1..036fb62f 100644 --- a/daemon.c +++ b/daemon.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #endif #include "fetchmail.h" +#include "tunable.h" RETSIGTYPE sigchld_handler (int sig) @@ -95,7 +97,7 @@ daemonize (const char *logfile, void (*termhook)(int)) group leader */ if ((childpid = fork()) < 0) { - perror("fork"); + error(0, errno, "fork"); return(PS_IOERR); } else if (childpid > 0) @@ -108,7 +110,7 @@ daemonize (const char *logfile, void (*termhook)(int)) #if defined(HAVE_SETSID) /* POSIX */ /* POSIX makes this soooo easy to do */ if (setsid() < 0) { - perror("setsid"); + error(0, errno, "setsid"); return(PS_IOERR); } #elif defined(SIGTSTP) /* BSD */ @@ -127,7 +129,7 @@ daemonize (const char *logfile, void (*termhook)(int)) /* lose controlling tty */ signal(SIGHUP, SIG_IGN); if ((childpid = fork) < 0) { - perror("fork"); + error(0, errno, "fork"); return(PS_IOERR); } else if (childpid > 0) { @@ -151,7 +153,7 @@ nottyDetach: /* Reopen stdin descriptor on /dev/null */ if ((fd = open("/dev/null", O_RDWR)) < 0) { /* stdin */ - perror("open: /dev/null"); + error(0, errno, "open: /dev/null"); return(PS_IOERR); } @@ -159,11 +161,11 @@ nottyDetach: fd = open(logfile, O_CREAT|O_WRONLY|O_APPEND, 0777); /* stdout */ else if (dup(fd) < 0) { /* stdout */ - perror("dup"); + error(0, errno, "dup"); return(PS_IOERR); } if (dup(fd) < 0) { /* stderr */ - perror("dup"); + error(0, errno, "dup"); return(PS_IOERR); } -- cgit v1.2.3