aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-27 22:20:07 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-27 22:20:07 +0200
commitca35292bf9eb91f75630c577990a581cba4a30ad (patch)
tree4f51964b1db34bf68638fa24adb5397340544c35
parentf3a7f87cc18352110a7b95d64bb4dba0d119ad37 (diff)
Lock and unlock stderr while printing diagnostics
-rw-r--r--lib/errors/vwarn.c2
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);
}