mirror of https://github.com/moparisthebest/wget
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:
parent
3056617e9c
commit
cacac6f996
|
@ -351,6 +351,7 @@ logputs (enum log_options o, const char *s)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
FILE *warcfp;
|
FILE *warcfp;
|
||||||
|
int errno_save = errno;
|
||||||
|
|
||||||
check_redirect_output ();
|
check_redirect_output ();
|
||||||
if (o == LOG_PROGRESS)
|
if (o == LOG_PROGRESS)
|
||||||
|
@ -358,10 +359,14 @@ logputs (enum log_options o, const char *s)
|
||||||
else
|
else
|
||||||
fp = get_log_fp ();
|
fp = get_log_fp ();
|
||||||
|
|
||||||
|
errno = errno_save;
|
||||||
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
warcfp = get_warc_log_fp ();
|
warcfp = get_warc_log_fp ();
|
||||||
|
errno = errno_save;
|
||||||
|
|
||||||
CHECK_VERBOSE (o);
|
CHECK_VERBOSE (o);
|
||||||
|
|
||||||
FPUTS (s, fp);
|
FPUTS (s, fp);
|
||||||
|
@ -373,6 +378,8 @@ logputs (enum log_options o, const char *s)
|
||||||
logflush ();
|
logflush ();
|
||||||
else
|
else
|
||||||
needs_flushing = true;
|
needs_flushing = true;
|
||||||
|
|
||||||
|
errno = errno_save;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct logvprintf_state {
|
struct logvprintf_state {
|
||||||
|
@ -546,6 +553,7 @@ logprintf (enum log_options o, const char *fmt, ...)
|
||||||
int errno_saved = errno;
|
int errno_saved = errno;
|
||||||
|
|
||||||
check_redirect_output ();
|
check_redirect_output ();
|
||||||
|
errno = errno_saved;
|
||||||
if (inhibit_logging)
|
if (inhibit_logging)
|
||||||
return;
|
return;
|
||||||
CHECK_VERBOSE (o);
|
CHECK_VERBOSE (o);
|
||||||
|
|
Loading…
Reference in New Issue