summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-08-24 14:07:10 -0700
committerWayne Davison <wayned@samba.org>2008-08-24 14:07:10 -0700
commit1d891835e7933f2c82bf636b0f27a936dc432e5c (patch)
tree1dc13a002415c909a6e03a4233eeb49186c722a8 /log.c
parent0b7894460092b8b3939f2d89ba9ebde15843d6ab (diff)
downloadrsync-1d891835e7933f2c82bf636b0f27a936dc432e5c.tar.gz
Improved rwrite() to handle a stderr exception without playing games
with the msgs2stderr value.
Diffstat (limited to 'log.c')
-rw-r--r--log.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/log.c b/log.c
index d67bd2e0..6d66e20a 100644
--- a/log.c
+++ b/log.c
@@ -246,7 +246,7 @@ static void filtered_fwrite(FILE *f, const char *buf, int len, int use_isprint)
void rwrite(enum logcode code, const char *buf, int len, int is_utf8)
{
int trailing_CR_or_NL;
- FILE *f = NULL;
+ FILE *f = msgs2stderr ? stderr : stdout;
#ifdef ICONV_OPTION
iconv_t ic = is_utf8 && ic_recv != (iconv_t)-1 ? ic_recv : ic_chck;
#else
@@ -258,7 +258,7 @@ void rwrite(enum logcode code, const char *buf, int len, int is_utf8)
if (len < 0)
exit_cleanup(RERR_MESSAGEIO);
- if (msgs2stderr > 0 && code != FLOG)
+ if (msgs2stderr && code != FLOG)
goto output_msg;
if (am_server && msg_fd_out >= 0) {
@@ -314,7 +314,7 @@ void rwrite(enum logcode code, const char *buf, int len, int is_utf8)
/* TODO: can we send the error to the user somehow? */
return;
}
- msgs2stderr = -1;
+ f = stderr;
}
output_msg:
@@ -328,7 +328,6 @@ output_msg:
break;
case FINFO:
case FCLIENT:
- f = msgs2stderr ? stderr : stdout;
break;
default:
exit_cleanup(RERR_MESSAGEIO);
@@ -453,7 +452,7 @@ void rsyserr(enum logcode code, int errcode, const char *format, ...)
void rflush(enum logcode code)
{
- FILE *f = NULL;
+ FILE *f;
if (am_daemon || code == FLOG)
return;