summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d3db3ee)
+ Changed a strncpy() call into a (more appropriate) memcpy() call.
+ Made the ellipsis[] string static because some older compilers may
not like the dynamic initialization of a character string.
+ Expanded some 1-line "case ... break;" statements onto separate
lines.
void rprintf(enum logcode code, const char *format, ...)
{
va_list ap;
void rprintf(enum logcode code, const char *format, ...)
{
va_list ap;
- char buf[MAXPATHLEN+512];
+ char buf[BIGPATHBUFLEN];
size_t len;
va_start(ap, format);
size_t len;
va_start(ap, format);
* truncate the resulting string. (Note that configure ensures
* that we have a vsnprintf() that doesn't ever return -1.) */
if (len > sizeof buf - 1) {
* truncate the resulting string. (Note that configure ensures
* that we have a vsnprintf() that doesn't ever return -1.) */
if (len > sizeof buf - 1) {
- const char ellipsis[] = "[...]";
+ static const char ellipsis[] = "[...]";
/* Reset length, and zero-terminate the end of our buffer */
len = sizeof buf - 1;
/* Reset length, and zero-terminate the end of our buffer */
len = sizeof buf - 1;
* If the input format string has a trailing newline,
* we copy it into that extra null; if it doesn't, well,
* all we lose is one byte. */
* If the input format string has a trailing newline,
* we copy it into that extra null; if it doesn't, well,
* all we lose is one byte. */
- strncpy(buf+len-sizeof ellipsis, ellipsis, sizeof ellipsis);
+ memcpy(buf+len-sizeof ellipsis, ellipsis, sizeof ellipsis);
if (format[strlen(format)-1] == '\n') {
buf[len-1] = '\n';
}
if (format[strlen(format)-1] == '\n') {
buf[len-1] = '\n';
}
void rsyserr(enum logcode code, int errcode, const char *format, ...)
{
va_list ap;
void rsyserr(enum logcode code, int errcode, const char *format, ...)
{
va_list ap;
- char buf[MAXPATHLEN+512];
+ char buf[BIGPATHBUFLEN];
size_t len;
strcpy(buf, RSYNC_NAME ": ");
size_t len;
strcpy(buf, RSYNC_NAME ": ");
- case 'h': if (am_daemon) n = client_name(0); break;
- case 'a': if (am_daemon) n = client_addr(0); break;
+ case 'h':
+ if (am_daemon)
+ n = client_name(0);
+ break;
+ case 'a':
+ if (am_daemon)
+ n = client_addr(0);
+ break;
case 'l':
strlcat(fmt, ".0f", sizeof fmt);
snprintf(buf2, sizeof buf2, fmt,
case 'l':
strlcat(fmt, ".0f", sizeof fmt);
snprintf(buf2, sizeof buf2, fmt,
(long)getpid());
n = buf2;
break;
(long)getpid());
n = buf2;
break;
- case 'o': n = op; break;
+ case 'o':
+ n = op;
+ break;
case 'f':
n = safe_fname(f_name(file));
if (am_sender && file->dir.root) {
case 'f':
n = safe_fname(f_name(file));
if (am_sender && file->dir.root) {
snprintf(buf2 + 4, sizeof buf2 - 4, fmt, n);
n = buf2;
break;
snprintf(buf2 + 4, sizeof buf2 - 4, fmt, n);
n = buf2;
break;
- case 'm': n = lp_name(module_id); break;
- case 't': n = timestring(time(NULL)); break;
- case 'P': n = lp_path(module_id); break;
- case 'u': n = auth_user; break;
+ case 'm':
+ n = lp_name(module_id);
+ break;
+ case 't':
+ n = timestring(time(NULL));
+ break;
+ case 'P':
+ n = lp_path(module_id);
+ break;
+ case 'u':
+ n = auth_user;
+ break;
case 'b':
if (am_sender) {
b = stats.total_written -
case 'b':
if (am_sender) {
b = stats.total_written -