summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron/do_command.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2015-10-03 19:47:21 +0000
committertedu <tedu@openbsd.org>2015-10-03 19:47:21 +0000
commit94b4a649956c89f14433d34f895013203cc6d277 (patch)
tree8108f46ec618053303d82ee55a790a1cbd472236 /usr.sbin/cron/do_command.c
parentEnable eigrpd(8) and eigrpctl(8) in the builds (diff)
downloadwireguard-openbsd-94b4a649956c89f14433d34f895013203cc6d277.tar.xz
wireguard-openbsd-94b4a649956c89f14433d34f895013203cc6d277.zip
There is no need to keep a global array of sysconf(_SC_OPEN_MAX) elements
just to keep track of a single pid. Return it to the caller and make it their problem. ok deraadt millert
Diffstat (limited to 'usr.sbin/cron/do_command.c')
-rw-r--r--usr.sbin/cron/do_command.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c
index b38db1a6141..912f97b5d4c 100644
--- a/usr.sbin/cron/do_command.c
+++ b/usr.sbin/cron/do_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: do_command.c,v 1.47 2015/10/03 12:46:54 tedu Exp $ */
+/* $OpenBSD: do_command.c,v 1.48 2015/10/03 19:47:21 tedu Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -321,6 +321,7 @@ child_process(entry *e, user *u)
char *mailto;
int bytes = 1;
int status = 0;
+ pid_t mailpid;
/* get name of recipient. this is MAILTO if set to a
* valid local username; USER otherwise.
@@ -350,7 +351,8 @@ child_process(entry *e, user *u)
fprintf(stderr, "mailcmd too long\n");
(void) _exit(EXIT_FAILURE);
}
- if (!(mail = cron_popen(mailcmd, "w", e->pwd))) {
+ if (!(mail = cron_popen(mailcmd, "w", e->pwd,
+ &mailpid))) {
perror(mailcmd);
(void) _exit(EXIT_FAILURE);
}
@@ -396,7 +398,7 @@ child_process(entry *e, user *u)
* it (the grandchild) is likely to exit
* after closing its stdout.
*/
- status = cron_pclose(mail);
+ status = cron_pclose(mail, mailpid);
}
/* if there was output and we could not mail it,