Date: Tue, 22 Dec 2015 15:32:45 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r292607 - head/usr.sbin/cron/cron Message-ID: <201512221532.tBMFWjiL055174@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Tue Dec 22 15:32:45 2015 New Revision: 292607 URL: https://svnweb.freebsd.org/changeset/base/292607 Log: cron: Check the return value of pipe(2) Fix inspired by: OpenBSD (rev 1.56) CID: 1009830 Modified: head/usr.sbin/cron/cron/do_command.c Modified: head/usr.sbin/cron/cron/do_command.c ============================================================================== --- head/usr.sbin/cron/cron/do_command.c Tue Dec 22 15:30:26 2015 (r292606) +++ head/usr.sbin/cron/cron/do_command.c Tue Dec 22 15:32:45 2015 (r292607) @@ -114,7 +114,7 @@ child_process(e, u) struct pam_conv pamc = { .conv = openpam_nullconv, .appdata_ptr = NULL - }; + } Debug(DPROC, ("[%d] checking account with PAM\n", getpid())) @@ -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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512221532.tBMFWjiL055174>