summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron/do_command.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2015-11-17 22:31:44 +0000
committermillert <millert@openbsd.org>2015-11-17 22:31:44 +0000
commit3b9f82754ff9dad4b5e21aa6dcb84771cbbfb4b6 (patch)
treea1299e92401a48740406abe534cee43c79172c6b /usr.sbin/cron/do_command.c
parentCheck for setgid() failure before executing editor and warn if (diff)
downloadwireguard-openbsd-3b9f82754ff9dad4b5e21aa6dcb84771cbbfb4b6.tar.xz
wireguard-openbsd-3b9f82754ff9dad4b5e21aa6dcb84771cbbfb4b6.zip
Check pipe(2) return value; noticed by deraadt@
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 1d5a0158c8e..be9050b7c5a 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.55 2015/11/15 23:24:24 millert Exp $ */
+/* $OpenBSD: do_command.c,v 1.56 2015/11/17 22:31:44 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -99,8 +99,10 @@ child_process(entry *e, user *u)
/* create some pipes to talk to our future child
*/
- pipe(stdin_pipe); /* child's stdin */
- pipe(stdout_pipe); /* child's stdout */
+ if (pipe(stdin_pipe) != 0 || pipe(stdout_pipe) != 0) {
+ syslog(LOG_ERR, "(CRON) PIPE (%m)");
+ _exit(EXIT_FAILURE);
+ }
/* since we are a forked process, we can diddle the command string
* we were passed -- nobody else is going to use it again, right?