aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fetchmail.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fetchmail.c b/fetchmail.c
index 7b3ca71c..233a36d1 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -493,13 +493,16 @@ int main(int argc, char **argv)
if (run.poll_interval && !getuid())
signal(SIGHUP, SIG_IGN);
}
- else if (run.logfile && access(run.logfile, F_OK) == 0)
+ else
{
- freopen(run.logfile, "a", stdout);
- freopen(run.logfile, "a", stderr);
+ deal_with_sigchld(); /* or else we may accumulate too many zombies */
+ if (run.logfile && access(run.logfile, F_OK) == 0)
+ {
+ freopen(run.logfile, "a", stdout);
+ freopen(run.logfile, "a", stderr);
+ }
}
-
#ifdef linux
interface_init();
#endif /* linux */