cron: Check the return value of pipe(2)

Fix inspired by:	OpenBSD (rev 1.56)
CID:	1009830
This commit is contained in:
Pedro F. Giffuni 2015-12-22 15:32:45 +00:00
parent 7044922b39
commit d985028157
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=292607

View file

@ -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?