Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 1 | From 92ab2e642d2c04b3dcb5a736ae6193680bfd5f74 Mon Sep 17 00:00:00 2001 |
| 2 | From: Paul Smith <psmith@gnu.org> |
| 3 | Date: Sun, 6 Nov 2022 15:22:02 -0500 |
| 4 | Subject: * src/main.c (main): [SV 63307] Handle SIGPIPE as a fatal signal |
| 5 | |
| 6 | Always ignoring SIGPIPE is visible to child processes. |
| 7 | |
| 8 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/make.git/commit/?id=92ab2e642d2c04b3dcb5a736ae6193680bfd5f74] |
| 9 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> |
| 10 | --- |
| 11 | src/main.c | 8 +++----- |
| 12 | 1 file changed, 3 insertions(+), 5 deletions(-) |
| 13 | |
| 14 | diff --git a/src/main.c b/src/main.c |
| 15 | index eec9365..f2caf7a 100644 |
| 16 | --- a/src/main.c |
| 17 | +++ b/src/main.c |
| 18 | @@ -1182,11 +1182,6 @@ main (int argc, char **argv, char **envp) |
| 19 | /* Useful for attaching debuggers, etc. */ |
| 20 | SPIN ("main-entry"); |
| 21 | |
| 22 | - /* Don't die if our stdout sends us SIGPIPE. */ |
| 23 | -#ifdef SIGPIPE |
| 24 | - bsd_signal (SIGPIPE, SIG_IGN); |
| 25 | -#endif |
| 26 | - |
| 27 | #ifdef HAVE_ATEXIT |
| 28 | if (ANY_SET (check_io_state (), IO_STDOUT_OK)) |
| 29 | atexit (close_stdout); |
| 30 | @@ -1265,6 +1260,9 @@ main (int argc, char **argv, char **envp) |
| 31 | #ifdef SIGQUIT |
| 32 | FATAL_SIG (SIGQUIT); |
| 33 | #endif |
| 34 | +#ifdef SIGPIPE |
| 35 | + FATAL_SIG (SIGPIPE); |
| 36 | +#endif |
| 37 | FATAL_SIG (SIGINT); |
| 38 | FATAL_SIG (SIGTERM); |
| 39 | |
| 40 | -- |
| 41 | cgit v1.1 |
| 42 | |