diff options
author | Paul Smith <psmith@gnu.org> | 2022-10-24 00:48:10 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-10-24 01:50:12 -0400 |
commit | 41c35f2ffe58a5b90b63256a199d674696f8a743 (patch) | |
tree | 3b6de9eaaa004266c632005f2157b5c426c1d74f /src/output.c | |
parent | deb4a42c3e85f1eb25f72c8952866625c0a3c7aa (diff) | |
download | make-git-41c35f2ffe58a5b90b63256a199d674696f8a743.tar.gz |
* src/output.c (_outputs): Don't use invalid output sync FDs
Just write to stdout/stderr in this situation.
Diffstat (limited to 'src/output.c')
-rw-r--r-- | src/output.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/output.c b/src/output.c index fa13e9c3..a88f537a 100644 --- a/src/output.c +++ b/src/output.c @@ -51,20 +51,24 @@ unsigned int stdio_traced = 0; static void _outputs (struct output *out, int is_err, const char *msg) { - if (! out || ! out->syncout) - { - FILE *f = is_err ? stderr : stdout; - fputs (msg, f); - fflush (f); - } - else + FILE *f; + + if (out && out->syncout) { int fd = is_err ? out->err : out->out; - size_t len = strlen (msg); - int r; - EINTRLOOP (r, lseek (fd, 0, SEEK_END)); - writebuf (fd, msg, len); + if (fd != OUTPUT_NONE) + { + size_t len = strlen (msg); + int r; + EINTRLOOP (r, lseek (fd, 0, SEEK_END)); + writebuf (fd, msg, len); + return; + } } + + f = is_err ? stderr : stdout; + fputs (msg, f); + fflush (f); } /* Write a message indicating that we've just entered or |