On Fri, Oct 20 2017, Florian Riehm <[email protected]> wrote:
> Hi,
>
> cron(8) opens /var/run/cron.sock for communication with crontab(1).
> The forked cronjobs have the socked still open.
> This prevents restarting cron while a job is running:
> (CRON) DEATH (already running)
Hah.
> I think cron's children should not inherit sockets.
>
> ok?
Looks reasonable, ok jca@
(I had to apply your diff manually, though. Could you please add
a newline between setproctitle(3) and your comment?)
> friehm
>
> Index: usr.sbin/cron/do_command.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/cron/do_command.c,v
> retrieving revision 1.56
> diff -u -p -r1.56 do_command.c
> --- usr.sbin/cron/do_command.c 17 Nov 2015 22:31:44 -0000 1.56
> +++ usr.sbin/cron/do_command.c 20 Oct 2017 13:56:27 -0000
> @@ -86,6 +86,9 @@ child_process(entry *e, user *u)
> /* mark ourselves as different to PS command watchers */
> setproctitle("running job");
> + /* close sockets from parent (i.e. cronSock) */
> + closefrom(3);
> +
> /* discover some useful and important environment settings
> */
> usernm = e->pwd->pw_name;
>
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE