summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron/cron/do_command.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-01-04 03:20:41 +0000
committerpfg <pfg@FreeBSD.org>2016-01-04 03:20:41 +0000
commitd9222b5f8fb29be6dea4f5d3a49acd3c3818668d (patch)
treeed2024fa036203f89b59b039aaf6da516080c45f /usr.sbin/cron/cron/do_command.c
parente239096251e02e9b318a77632b5df90807e2ed61 (diff)
downloadFreeBSD-src-d9222b5f8fb29be6dea4f5d3a49acd3c3818668d.zip
FreeBSD-src-d9222b5f8fb29be6dea4f5d3a49acd3c3818668d.tar.gz
MFC r292605, r292606, r292607, r292608:
cron: bring some fixes for Coverity reports and other issues. crontab: replace malloc + bzero with calloc crontab: properly free an entry cron: Check the return value of pipe(2) CID: 271773, 1009830,
Diffstat (limited to 'usr.sbin/cron/cron/do_command.c')
-rw-r--r--usr.sbin/cron/cron/do_command.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c
index fee4131..1ad8395 100644
--- a/usr.sbin/cron/cron/do_command.c
+++ b/usr.sbin/cron/cron/do_command.c
@@ -161,8 +161,10 @@ child_process(e, 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) {
+ log_it("CRON", getpid(), "error", "can't pipe");
+ exit(ERROR_EXIT);
+ }
/* since we are a forked process, we can diddle the command string
* we were passed -- nobody else is going to use it again, right?
OpenPOWER on IntegriCloud