static FILE *logfile_fp;
struct stats stats;
-int log_got_error = 0;
+int got_xfer_error = 0;
struct {
int code;
{ RERR_PARTIAL , "some files could not be transferred" },
{ RERR_VANISHED , "some files vanished before they could be transferred" },
{ RERR_TIMEOUT , "timeout in data send/receive" },
+ { RERR_CONTIMEOUT , "timeout waiting for daemon connection" },
{ RERR_CMD_FAILED , "remote shell failed" },
{ RERR_CMD_KILLED , "remote shell killed" },
{ RERR_CMD_RUN , "remote command could not be run" },
}
/* this is the underlying (unformatted) rsync debugging function. Call
- * it with FINFO, FERROR or FLOG. Note: recursion can happen with
- * certain fatal conditions. */
+ * it with FINFO, FERROR_*, FWARNING, FLOG, or FCLIENT. Note: recursion
+ * can happen with certain fatal conditions. */
void rwrite(enum logcode code, const char *buf, int len, int is_utf8)
{
int trailing_CR_or_NL;
return;
}
- if (code == FSOCKERR) /* This gets simplified for a non-sibling. */
+ if (code == FERROR_SOCKET) /* This gets simplified for a non-sibling. */
code = FERROR;
if (code == FCLIENT)
else if (am_daemon || logfile_name) {
static int in_block;
char msg[2048];
- int priority = code == FERROR ? LOG_WARNING : LOG_INFO;
+ int priority = code == FINFO || code == FLOG ? LOG_INFO : LOG_WARNING;
if (in_block)
return;
} else if (code == FLOG)
return;
- if (quiet && code != FERROR)
+ if (quiet && code == FINFO)
return;
if (am_server) {
+ enum msgcode msg = (enum msgcode)code;
+ if (protocol_version < 30) {
+ if (msg == MSG_ERROR)
+ msg = MSG_ERROR_XFER;
+ else if (msg == MSG_WARNING)
+ msg = MSG_INFO;
+ }
/* Pass the message to the non-server side. */
- if (send_msg((enum msgcode)code, buf, len, !is_utf8))
+ if (send_msg(msg, buf, len, !is_utf8))
return;
if (am_daemon) {
/* TODO: can we send the error to the user somehow? */
}
switch (code) {
+ case FERROR_XFER:
+ got_xfer_error = 1;
+ /* FALL THROUGH */
case FERROR:
- log_got_error = 1;
+ case FWARNING:
f = stderr;
break;
case FINFO:
}
}
-/* This is the rsync debugging function. Call it with FINFO, FERROR or
- * FLOG. */
+/* This is the rsync debugging function. Call it with FINFO, FERROR_*,
+ * FWARNING, FLOG, or FCLIENT. */
void rprintf(enum logcode code, const char *format, ...)
{
va_list ap;
if (am_daemon || code == FLOG)
return;
- if (code == FERROR || am_server)
- f = stderr;
- else
+ if (code == FINFO && !am_server)
f = stdout;
+ else
+ f = stderr;
fflush(f);
}
break;
case 'i':
if (iflags & ITEM_DELETED) {
- n = "*deleting";
+ n = "*deleting ";
break;
}
n = c = buf2 + MAXPATHLEN - 32;
/* VANISHED is not an error, only a warning */
if (code == RERR_VANISHED) {
- rprintf(FINFO, "rsync warning: %s (code %d) at %s(%d) [%s=%s]\n",
+ rprintf(FWARNING, "rsync warning: %s (code %d) at %s(%d) [%s=%s]\n",
name, code, file, line, who_am_i(), RSYNC_VERSION);
} else {
rprintf(FERROR, "rsync error: %s (code %d) at %s(%d) [%s=%s]\n",