1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Retain value of errno in logprintf(), logputs() even better

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

Reported-by: Gisle Vanem <gvanem@yahoo.no>
This commit is contained in:
Tim Rühsen 2016-02-11 10:53:02 +01:00
parent 3056617e9c
commit cacac6f996

View File

@ -351,6 +351,7 @@ logputs (enum log_options o, const char *s)
{
FILE *fp;
FILE *warcfp;
int errno_save = errno;
check_redirect_output ();
if (o == LOG_PROGRESS)
@ -358,10 +359,14 @@ logputs (enum log_options o, const char *s)
else
fp = get_log_fp ();
errno = errno_save;
if (fp == NULL)
return;
warcfp = get_warc_log_fp ();
errno = errno_save;
CHECK_VERBOSE (o);
FPUTS (s, fp);
@ -373,6 +378,8 @@ logputs (enum log_options o, const char *s)
logflush ();
else
needs_flushing = true;
errno = errno_save;
}
struct logvprintf_state {
@ -546,6 +553,7 @@ logprintf (enum log_options o, const char *fmt, ...)
int errno_saved = errno;
check_redirect_output ();
errno = errno_saved;
if (inhibit_logging)
return;
CHECK_VERBOSE (o);