extern int allow_8bit_chars;
extern int protocol_version;
extern int preserve_times;
-extern int in_exit_cleanup;
extern int stdout_format_has_i;
extern int stdout_format_has_o_or_i;
extern int logfile_format_has_i;
{ 0, NULL }
};
-#define EXIT_OR_RETURN(err) \
- do { \
- if (in_exit_cleanup) \
- return; \
- exit_cleanup(err); \
- } while (0)
-
-
/*
* Map from rsync error code to name, or return NULL.
*/
&& ((use_isprint && !isprint(*(uchar*)s))
|| *(uchar*)s < ' '))) {
if (s != buf && fwrite(buf, s - buf, 1, f) != 1)
- EXIT_OR_RETURN(RERR_MESSAGEIO);
+ exit_cleanup(RERR_MESSAGEIO);
fprintf(f, "\\#%03o", *(uchar*)s);
buf = s + 1;
}
}
if (buf != end && fwrite(buf, end - buf, 1, f) != 1)
- EXIT_OR_RETURN(RERR_MESSAGEIO);
+ exit_cleanup(RERR_MESSAGEIO);
}
/* this is the underlying (unformatted) rsync debugging function. Call
FILE *f = NULL;
if (len < 0)
- EXIT_OR_RETURN(RERR_MESSAGEIO);
+ exit_cleanup(RERR_MESSAGEIO);
if (am_server && msg_fd_out >= 0) {
/* Pass the message to our sibling. */
f = am_server ? stderr : stdout;
break;
default:
- EXIT_OR_RETURN(RERR_MESSAGEIO);
+ exit_cleanup(RERR_MESSAGEIO);
}
trailing_CR_or_NL = len && (buf[len-1] == '\n' || buf[len-1] == '\r')
char buf[BIGPATHBUFLEN];
size_t len;
- strcpy(buf, RSYNC_NAME ": ");
+ strlcpy(buf, RSYNC_NAME ": ", sizeof buf);
len = (sizeof RSYNC_NAME ": ") - 1;
va_start(ap, format);
": %s (%d)\n", strerror(errcode), errcode);
}
if (len >= sizeof buf)
- EXIT_OR_RETURN(RERR_MESSAGEIO);
+ exit_cleanup(RERR_MESSAGEIO);
rwrite(code, buf, len);
}
total = strlcpy(buf, format, sizeof buf);
if (total > MAXPATHLEN) {
rprintf(FERROR, "log-format string is WAY too long!\n");
- EXIT_OR_RETURN(RERR_MESSAGEIO);
+ exit_cleanup(RERR_MESSAGEIO);
}
buf[total++] = '\n';
buf[total] = '\0';
case 'L':
if (hlink && *hlink) {
n = hlink;
- strcpy(buf2, " => ");
+ strlcpy(buf2, " => ", sizeof buf2);
} else if (S_ISLNK(file->mode) && file->u.link) {
n = file->u.link;
- strcpy(buf2, " -> ");
+ strlcpy(buf2, " -> ", sizeof buf2);
} else {
n = "";
if (!fmt[1])
break;
- strcpy(buf2, " ");
+ strlcpy(buf2, " ", sizeof buf2);
}
strlcat(fmt, "s", sizeof fmt);
snprintf(buf2 + 4, sizeof buf2 - 4, fmt, n);
rprintf(FERROR,
"buffer overflow expanding %%%c -- exiting\n",
p[0]);
- EXIT_OR_RETURN(RERR_MESSAGEIO);
+ exit_cleanup(RERR_MESSAGEIO);
}
/* Shuffle the rest of the string along to make space for n */