diff --git a/usr.bin/mail/send.c b/usr.bin/mail/send.c --- a/usr.bin/mail/send.c +++ b/usr.bin/mail/send.c @@ -293,8 +293,10 @@ * Collect user's mail from standard input. * Get the result as mtf. */ - if ((mtf = collect(hp, printheaders)) == NULL) + if ((mtf = collect(hp, printheaders)) == NULL) { + senderr++; return; + } if (value("interactive") != NULL) { if (value("askcc") != NULL || value("askbcc") != NULL) { if (value("askcc") != NULL) diff --git a/usr.bin/mail/tests/mail_sigint_test.c b/usr.bin/mail/tests/mail_sigint_test.c --- a/usr.bin/mail/tests/mail_sigint_test.c +++ b/usr.bin/mail/tests/mail_sigint_test.c @@ -39,7 +39,7 @@ /* input, output, error, sync pipes */ if (pipe(ipd) != 0 || pipe(opd) != 0 || pipe(epd) != 0 || - pipe2(spd, O_CLOEXEC) != 0) + pipe(spd) != 0 || fcntl(spd[1], F_SETFD, FD_CLOEXEC) != 0) atf_tc_fail("failed to pipe"); /* fork child */ if ((pid = fork()) < 0) @@ -55,6 +55,7 @@ dup2(epd[1], STDERR_FILENO); close(epd[0]); close(epd[1]); + close(spd[0]); /* force dead.letter to go to cwd */ setenv("HOME", ".", 1); /* exec mailx */ @@ -113,7 +114,7 @@ close(spd[0]); if (interactive) { ATF_CHECK(WIFEXITED(status)); - ATF_CHECK_INTEQ(0, WEXITSTATUS(status)); + ATF_CHECK_INTEQ(1, WEXITSTATUS(status)); ATF_CHECK_INTEQ(2, kc); ATF_CHECK_STREQ("", obuf); ATF_CHECK_MATCH("Interrupt -- one more to kill letter", ebuf);