File vixie-cron-4.1-vfork_sigchld.diff of Package cron
--- vixie-cron-4.1/do_command.c
+++ vixie-cron-4.1/do_command.c
@@ -136,13 +136,13 @@
/* fork again, this time so we can exec the user's command.
*/
- switch (vfork()) {
+ switch (fork()) {
case -1:
- log_it("CRON", getpid(), "error", "can't vfork");
+ log_it("CRON", getpid(), "error", "can't fork");
exit(ERROR_EXIT);
/*NOTREACHED*/
case 0:
- Debug(DPROC, ("[%ld] grandchild process vfork()'ed\n",
+ Debug(DPROC, ("[%ld] grandchild process fork()'ed\n",
(long)getpid()))
/* write a log message. we've waited this long to do it
@@ -187,6 +187,13 @@
}
dup2(STDOUT, STDERR);
+ /* Our grandparent is watching for our parent's death by
+ * catching SIGCHLD. Meanwhile, our parent will use wait
+ * explicitly and so has disabled SIGCHLD. So now it's
+ * time to reset SIGCHLD handling.
+ */
+ (void) signal(SIGCHLD, SIG_DFL);
+
/* set our directory, uid and gid. Set gid first, since once
* we set uid, we've lost root privledges.
*/
--- vixie-cron-4.1/popen.c
+++ vixie-cron-4.1/popen.c
@@ -84,7 +84,7 @@
break;
argv[MAX_ARGV-1] = NULL;
- switch (pid = vfork()) {
+ switch (pid = fork()) {
case -1: /* error */
(void)close(pdes[0]);
(void)close(pdes[1]);