diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2025-04-29 15:12:17 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2025-04-29 15:12:30 +0000 |
| commit | 09bc6a5d5b3333bc91e5f9fdf1e7bb282c4aea5a (patch) | |
| tree | 154f0af862199e85606ba6d7ad69f501d29e4e3d | |
| parent | 578cbd03f7a53eb23b71b560f8816f84f5a1461b (diff) | |
| -rw-r--r-- | usr.bin/mail/send.c | 4 | ||||
| -rw-r--r-- | usr.bin/mail/tests/mail_sigint_test.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/mail/send.c b/usr.bin/mail/send.c index b4fbd4cbfd8a..fe1086264a9c 100644 --- a/usr.bin/mail/send.c +++ b/usr.bin/mail/send.c @@ -293,8 +293,10 @@ mail1(struct header *hp, int printheaders) * 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 index 76bf9b19b7f1..e2889493f3cd 100644 --- a/usr.bin/mail/tests/mail_sigint_test.c +++ b/usr.bin/mail/tests/mail_sigint_test.c @@ -39,7 +39,7 @@ mailx_sigint(bool interactive) /* 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 @@ mailx_sigint(bool interactive) 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 @@ mailx_sigint(bool interactive) 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); |
