Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improved rwrite() to handle a stderr exception without playing games
[rsync/rsync.git]
/
log.c
diff --git
a/log.c
b/log.c
index
d67bd2e
..
6d66e20
100644
(file)
--- 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;
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
#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 (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) {
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;
}
/* TODO: can we send the error to the user somehow? */
return;
}
-
msgs2stderr = -1
;
+
f = stderr
;
}
output_msg:
}
output_msg:
@@
-328,7
+328,6
@@
output_msg:
break;
case FINFO:
case FCLIENT:
break;
case FINFO:
case FCLIENT:
- f = msgs2stderr ? stderr : stdout;
break;
default:
exit_cleanup(RERR_MESSAGEIO);
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)
{
void rflush(enum logcode code)
{
- FILE *f
= NULL
;
+ FILE *f;
if (am_daemon || code == FLOG)
return;
if (am_daemon || code == FLOG)
return;