From ca35292bf9eb91f75630c577990a581cba4a30ad Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 27 Apr 2024 22:20:07 +0200 Subject: Lock and unlock stderr while printing diagnostics --- lib/errors/vwarn.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/errors') 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); } -- cgit v1.2.3