Fix check for dup2() return value.

This commit is contained in:
Todd C. Miller
2010-07-19 12:54:30 -04:00
parent 2eb1879fd7
commit 10e6e572ea

View File

@@ -490,7 +490,7 @@ send_mail(const char *fmt, ...)
/* Child, set stdin to output side of the pipe */ /* Child, set stdin to output side of the pipe */
if (pfd[0] != STDIN_FILENO) { if (pfd[0] != STDIN_FILENO) {
if (dup2(pfd[0], STDIN_FILENO) != -1) { if (dup2(pfd[0], STDIN_FILENO) == -1) {
mysyslog(LOG_ERR, "cannot dup stdin: %m"); mysyslog(LOG_ERR, "cannot dup stdin: %m");
_exit(127); _exit(127);
} }