diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-04-27 22:20:07 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-04-27 22:20:07 +0200 |
commit | ca35292bf9eb91f75630c577990a581cba4a30ad (patch) | |
tree | 4f51964b1db34bf68638fa24adb5397340544c35 | |
parent | f3a7f87cc18352110a7b95d64bb4dba0d119ad37 (diff) |
Lock and unlock stderr while printing diagnostics
-rw-r--r-- | lib/errors/vwarn.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/errors/vwarn.c b/lib/errors/vwarn.c index 342c391..bc1dda7 100644 --- a/lib/errors/vwarn.c +++ b/lib/errors/vwarn.c @@ -9,9 +9,11 @@ void vwarn(const char *fmt, va_list ap) { int save = errno; + flockfile(stderr); fprintf(stderr, "%s: ", mlib_progname()); vfprintf(stderr, fmt, ap); if (fmt[strlen(fmt) - 1] == ':') fprintf(stderr, " %s", strerror(save)); fputc('\n', stderr); + funlockfile(stderr); } |