extern struct filter_list_struct server_filter_list;
int io_error;
+int checksum_len;
dev_t filesystem_dev; /* used to implement -x */
static char empty_sum[MD4_SUM_LENGTH];
/* Figure out how big the file_struct is without trailing padding */
file_struct_len = offsetof(struct file_struct, flags) + sizeof f.flags;
+ checksum_len = protocol_version < 21 ? 2 : MD4_SUM_LENGTH;
}
static int show_filelist_p(void)
rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
perms,
(double)f->length, timestring(f->modtime),
- safe_fname(f_name(f)), safe_fname(f->u.link));
+ f_name(f), f->u.link);
} else
#endif
{
rprintf(FINFO, "%s %11.0f %s %s\n",
perms,
(double)f->length, timestring(f->modtime),
- safe_fname(f_name(f)));
+ f_name(f));
}
}
if (copy_unsafe_links && unsafe_symlink(linkbuf, path)) {
if (verbose > 1) {
rprintf(FINFO,"copying unsafe symlink \"%s\" -> \"%s\"\n",
- safe_fname(path), safe_fname(linkbuf));
+ path, linkbuf);
}
return do_stat(path, buffer);
}
if (always_checksum && (S_ISREG(mode) || protocol_version < 28)) {
char *sum;
- int slen = protocol_version < 21 ? 2 : MD4_SUM_LENGTH;
if (S_ISREG(mode))
sum = file->u.sum;
else {
/* Prior to 28, we sent a useless set of nulls. */
sum = empty_sum;
}
- write_buf(f, sum, slen);
+ write_buf(f, sum, checksum_len);
}
strlcpy(lastname, fname, MAXPATHLEN);
if (l2 >= MAXPATHLEN - l1) {
rprintf(FERROR,
"overflow: flags=0x%x l1=%d l2=%d lastname=%s\n",
- flags, l1, l2, safe_fname(lastname));
+ flags, l1, l2, lastname);
overflow_exit("receive_file_entry");
}
if (always_checksum && (sum_len || protocol_version < 28)) {
char *sum;
- int slen = protocol_version < 21 ? 2 : MD4_SUM_LENGTH;
if (sum_len) {
file->u.sum = sum = bp;
/*bp += sum_len;*/
/* Prior to 28, we get a useless set of nulls. */
sum = empty_sum;
}
- read_buf(f, sum, slen);
+ read_buf(f, sum, checksum_len);
}
if (!preserve_perms) {
if (strlcpy(thisname, fname, sizeof thisname)
>= sizeof thisname - flist_dir_len) {
- rprintf(FINFO, "skipping overly long name: %s\n",
- safe_fname(fname));
+ rprintf(FINFO, "skipping overly long name: %s\n", fname);
return NULL;
}
clean_fname(thisname, 0);
goto skip_filters;
if (S_ISDIR(st.st_mode) && !xfer_dirs) {
- rprintf(FINFO, "skipping directory %s\n", safe_fname(thisname));
+ rprintf(FINFO, "skipping directory %s\n", thisname);
return NULL;
}
return NULL;
}
-skip_filters:
+ skip_filters:
if (verbose > 2) {
rprintf(FINFO, "[%s] make_file(%s,*,%d)\n",
- who_am_i(), safe_fname(thisname), filter_level);
+ who_am_i(), thisname, filter_level);
}
if ((basename = strrchr(thisname, '/')) != NULL) {
linkname_len = 0;
#endif
- sum_len = always_checksum && S_ISREG(st.st_mode) ? MD4_SUM_LENGTH : 0;
+ sum_len = always_checksum && am_sender && S_ISREG(st.st_mode)
+ ? MD4_SUM_LENGTH : 0;
alloc_len = file_struct_len + dirname_len + basename_len
+ linkname_len + sum_len;
if (dname[0] == '.' && (dname[1] == '\0'
|| (dname[1] == '.' && dname[2] == '\0')))
continue;
- if (strlcpy(p, dname, remainder) < remainder)
- send_file_name(f, flist, fbuf, 0);
- else {
+ if (strlcpy(p, dname, remainder) >= remainder) {
io_error |= IOERR_GENERAL;
rprintf(FINFO,
"cannot send long-named file %s\n",
full_fname(fbuf));
}
+
+ send_file_name(f, flist, fbuf, 0);
}
fbuf[len] = '\0';
}
if (S_ISDIR(st.st_mode) && !xfer_dirs) {
- rprintf(FINFO, "skipping directory %s\n",
- safe_fname(fbuf));
+ rprintf(FINFO, "skipping directory %s\n", fbuf);
continue;
}
if (!flist->files)
goto oom;
-
while ((flags = read_byte(f)) != 0) {
struct file_struct *file;
maybe_emit_filelist_progress(flist->count);
- if (verbose > 2) {
- rprintf(FINFO, "recv_file_name(%s)\n",
- safe_fname(f_name(file)));
- }
+ if (verbose > 2)
+ rprintf(FINFO, "recv_file_name(%s)\n", f_name(file));
}
receive_file_entry(NULL, 0, 0); /* Signal that we're done. */
return flist;
-oom:
+ oom:
out_of_memory("recv_file_list");
return NULL; /* not reached */
}
if (verbose > 1 && !am_server) {
rprintf(FINFO,
"removing duplicate name %s from file list (%d)\n",
- safe_fname(f_name(file)), drop);
+ f_name(file), drop);
}
/* Make sure that if we unduplicate '.', that we don't
* lose track of a user-specified top directory. */
sprintf(depthbuf, "%d", file->dir.depth);
rprintf(FINFO, "[%s] i=%d %s %s%s%s%s mode=0%o len=%.0f%s%s flags=%x\n",
who, i, am_sender ? NS(file->dir.root) : depthbuf,
- file->dirname ? safe_fname(file->dirname) : "",
+ file->dirname ? file->dirname : "",
file->dirname ? "/" : "", NS(file->basename),
S_ISDIR(file->mode) ? "/" : "", (int)file->mode,
(double)file->length, uidbuf, gidbuf, file->flags);
strcpy(fbuf + len + 1, f->basename);
} else
strcpy(fbuf, f->basename);
+
return fbuf;
}