diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-12-17 02:09:51 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-12-17 02:09:51 +0000 |
commit | 0922eb1ccb33983bd4ad2d5c38475d56e2e60137 (patch) | |
tree | 5d4e126da335d88279e0447feb988a5816f29a63 /daemon.c | |
parent | d4009e757f45a4f09bd415cc032b079f316b4c46 (diff) | |
download | fetchmail-0922eb1ccb33983bd4ad2d5c38475d56e2e60137.tar.gz fetchmail-0922eb1ccb33983bd4ad2d5c38475d56e2e60137.tar.bz2 fetchmail-0922eb1ccb33983bd4ad2d5c38475d56e2e60137.zip |
Use error() for messages almost everywhere.
svn path=/trunk/; revision=636
Diffstat (limited to 'daemon.c')
-rw-r--r-- | daemon.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -7,6 +7,7 @@ #include <config.h> #include <stdio.h> +#include <errno.h> #include <signal.h> #include <sys/types.h> #include <sys/stat.h> @@ -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); } |