code = exit_code;
/* If this is the exit at the end of the run, the server side
- * should not attempt to output a message (see log.c). */
+ * should not attempt to output a message (see log_exit()). */
if (am_server && code == 0)
am_server = 2;
if (len < 0)
exit_cleanup(RERR_MESSAGEIO);
- if (msgs2stderr && code != FLOG) {
- f = stderr;
+ if (msgs2stderr > 0 && code != FLOG)
goto output_msg;
- }
if (am_server && msg_fd_out >= 0) {
assert(!is_utf8);
/* TODO: can we send the error to the user somehow? */
return;
}
+ msgs2stderr = -1;
}
+output_msg:
switch (code) {
case FERROR_XFER:
got_xfer_error = 1;
f = stderr;
break;
case FINFO:
- f = am_server ? stderr : stdout;
+ case FCLIENT:
+ f = msgs2stderr ? stderr : stdout;
break;
default:
exit_cleanup(RERR_MESSAGEIO);
}
-output_msg:
if (output_needs_newline) {
fputc('\n', f);
output_needs_newline = 0;