diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-06-27 19:22:33 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-06-27 19:22:33 +0000 |
commit | c4aa3433b8d186e07678a2c40b2a12751fe975cf (patch) | |
tree | bf8a6fbeb506587b745985ec79d1c46eac379e17 /daemon.c | |
parent | d98d211d8b8832c01d8ccccb501fd419b8f430e1 (diff) | |
download | fetchmail-c4aa3433b8d186e07678a2c40b2a12751fe975cf.tar.gz fetchmail-c4aa3433b8d186e07678a2c40b2a12751fe975cf.tar.bz2 fetchmail-c4aa3433b8d186e07678a2c40b2a12751fe975cf.zip |
Sent to ceharris.
svn path=/trunk/; revision=10
Diffstat (limited to 'daemon.c')
-rw-r--r-- | daemon.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -25,6 +25,9 @@ BSD systems. $Log: daemon.c,v $ + Revision 1.3 1996/06/27 19:22:31 esr + Sent to ceharris. + Revision 1.2 1996/06/26 19:08:57 esr This is what I sent Harris. @@ -57,6 +60,7 @@ #include "popclient.h" +static void (*my_termhook)(void); /****************************************************************** function: sigchld_handler @@ -80,6 +84,9 @@ sigchld_handler () int status; #endif + if (my_termhook) + (*my_termhook)(); + #if defined(HAVE_WAIT3) while ((pid = wait3(&status, WNOHANG, (struct rusage *) 0)) > 0) ; /* swallow 'em up. */ @@ -109,8 +116,9 @@ sigchld_handler () *****************************************************************/ int -daemonize (logfile) +daemonize (logfile, termhook) const char *logfile; +void (*termhook)(void); { int fd; pid_t childpid; @@ -119,6 +127,8 @@ const char *logfile; /* if we are started by init (process 1) via /etc/inittab we needn't bother to detach from our process group context */ + my_termhook = termhook; + if (getppid() == 1) goto nottyDetach; |