Retain value of errno in logprintf()

* src/log.c (logprintf): Save&Restore value of errno

Reported-by: Gisle Vanem <gvanem@yahoo.no>
This commit is contained in:
Tim Rühsen 2016-02-10 15:23:13 +01:00
parent c190677cab
commit 3056617e9c
1 changed files with 3 additions and 0 deletions

View File

@ -543,6 +543,7 @@ logprintf (enum log_options o, const char *fmt, ...)
va_list args;
struct logvprintf_state lpstate;
bool done;
int errno_saved = errno;
check_redirect_output ();
if (inhibit_logging)
@ -561,6 +562,8 @@ logprintf (enum log_options o, const char *fmt, ...)
exit (WGET_EXIT_GENERIC_ERROR);
}
while (!done);
errno = errno_saved;
}
#ifdef ENABLE_DEBUG