diff options
author | Dmitry Goncharov <dgoncharov@users.sf.net> | 2022-10-21 18:54:39 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-10-22 09:45:40 -0400 |
commit | 5b1ca277caefca44baf0aeaea2e32766e9bff097 (patch) | |
tree | b34f936b18c5a17f03fec62fc5720ecc3b7c2b63 /src | |
parent | 7c71df5695720dcf5947a7eba1682452ee497288 (diff) | |
download | make-git-5b1ca277caefca44baf0aeaea2e32766e9bff097.tar.gz |
[SV 63248] Ignore SIGPIPE
Don't terminate when make's output is redirected to a pipe and the
reader exits early; e.g.:
$ echo 'all:; sleep 2' | make -f- -j2 -O |:
This lets us unlink temporary files, and tell the user that make was
not able to write its output.
Reported by Frank Heckenbach <f.heckenbach@fh-soft.de>.
* src/main.c (main): Ignore SIGPIPE.
* src/posixos.c (osync_clear): Fix a memory leak.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/posixos.c | 1 |
2 files changed, 6 insertions, 0 deletions
@@ -1182,6 +1182,11 @@ main (int argc, char **argv, char **envp) /* Useful for attaching debuggers, etc. */ SPIN ("main-entry"); + /* Don't die if our stdout sends us SIGPIPE. */ +#ifdef SIGPIPE + bsd_signal (SIGPIPE, SIG_IGN); +#endif + #ifdef HAVE_ATEXIT if (ANY_SET (check_io_state (), IO_STDOUT_OK)) atexit (close_stdout); diff --git a/src/posixos.c b/src/posixos.c index a48116db..fca31927 100644 --- a/src/posixos.c +++ b/src/posixos.c @@ -699,6 +699,7 @@ osync_clear () int r; EINTRLOOP (r, unlink (osync_tmpfile)); + free (osync_tmpfile); osync_tmpfile = NULL; } } |