Commit Diff
- Commit:
4d0b6596a3fd608f26c1ff6c5e445601160ba99f
- From:
- Omar Polo <op@omarpolo.com>
- Via:
- Thomas Adam <thomas@xteddy.org>
- Date:
- Message:
- got: flush stdout before printing the error in main() Since standard error is unbuffered, it could happen that the error string is printed immediately while the output from the subcommand is stuck in a buffer and written later. So flush() standard output before printing the error message. Problem reported by naddy@, ok stsp@
- Actions:
- Patch | Tree
--- got/got.c +++ got/got.c @@ -264,6 +264,7 @@ main(int argc, char *argv[]) error->code == GOT_ERR_ERRNO && errno == EPIPE) && !(sigint_received && error->code == GOT_ERR_ERRNO && errno == EINTR)) { + fflush(stdout); fprintf(stderr, "%s: %s\n", getprogname(), error->msg); return 1; }