commit bb8372e04232a682437a47c1b3178a865b46e076
parent 03d2db037569b380e1ba5cadfb45ce69db3b679e
Author: sin <sin@2f30.org>
Date: Wed, 9 Jul 2014 08:26:33 +0100
Write pid after daemonizing
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/crond.c b/crond.c
@@ -442,12 +442,12 @@ main(int argc, char *argv[])
usage();
if (nflag == 0) {
+ openlog(argv[0], LOG_CONS | LOG_PID, LOG_CRON);
+ daemon(1, 0);
if ((fp = fopen(pidfile, "w"))) {
fprintf(fp, "%d\n", getpid());
fclose(fp);
}
- openlog(argv[0], LOG_CONS | LOG_PID, LOG_CRON);
- daemon(1, 0);
}
signal(SIGCHLD, sighandler);