die_with_error: Save errno sooner

We need to save errno immediately, otherwise it could be overwritten
by a failing library call somewhere in the implementation of fprintf.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2021-10-10 12:45:50 +01:00
committed by Alexander Larsson
parent 235856771e
commit 22af8f72ec

View File

@@ -56,10 +56,10 @@ die_with_error (const char *format, ...)
va_list args;
int errsv;
fprintf (stderr, "bwrap: ");
errsv = errno;
fprintf (stderr, "bwrap: ");
va_start (args, format);
vfprintf (stderr, format, args);
va_end (args);