From 45c49b52a488882bbbd5366420389abbbeede7c9 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 13 Jan 2006 21:17:09 +0000 Subject: [PATCH] Got rid of calls to (the soon to vanish) safe_fname() function. --- authenticate.c | 6 ++--- backup.c | 15 ++++++------- batch.c | 12 +++++----- cleanup.c | 4 ++-- clientserver.c | 10 ++++----- exclude.c | 9 ++++---- generator.c | 60 ++++++++++++++++++++++---------------------------- hlink.c | 14 +++++------- main.c | 12 +++++----- params.c | 2 +- pipe.c | 3 +-- receiver.c | 28 ++++++++++------------- rsync.c | 20 ++++++++--------- sender.c | 22 +++++++----------- 14 files changed, 95 insertions(+), 122 deletions(-) diff --git a/authenticate.c b/authenticate.c index 12f142ec..55ed2693 100644 --- a/authenticate.c +++ b/authenticate.c @@ -90,7 +90,7 @@ static int get_secret(int module, char *user, char *secret, int len) return 0; if (do_stat(fname, &st) == -1) { - rsyserr(FLOG, errno, "stat(%s)", safe_fname(fname)); + rsyserr(FLOG, errno, "stat(%s)", fname); ok = 0; } else if (lp_strict_modes(module)) { if ((st.st_mode & 06) != 0) { @@ -160,14 +160,14 @@ static char *getpassf(char *filename) if ((fd = open(filename,O_RDONLY)) < 0) { rsyserr(FERROR, errno, "could not open password file \"%s\"", - safe_fname(filename)); + filename); if (envpw) rprintf(FERROR, "falling back to RSYNC_PASSWORD environment variable.\n"); return NULL; } if (do_stat(filename, &st) == -1) { - rsyserr(FERROR, errno, "stat(%s)", safe_fname(filename)); + rsyserr(FERROR, errno, "stat(%s)", filename); ok = 0; } else if ((st.st_mode & 06) != 0) { rprintf(FERROR,"password file must not be other-accessible\n"); diff --git a/backup.c b/backup.c index 84715db8..e34b7be9 100644 --- a/backup.c +++ b/backup.c @@ -65,8 +65,7 @@ static int make_simple_backup(char *fname) if (do_rename(fname, fnamebak) == 0) { if (verbose > 1) { rprintf(FINFO, "backed up %s to %s\n", - safe_fname(fname), - safe_fname(fnamebak)); + fname, fnamebak); } break; } @@ -81,7 +80,7 @@ static int make_simple_backup(char *fname) continue; rsyserr(FERROR, rename_errno, "rename %s to backup %s", - safe_fname(fname), safe_fname(fnamebak)); + fname, fnamebak); errno = rename_errno; return 0; } @@ -197,7 +196,7 @@ static int keep_backup(char *fname) full_fname(buf)); } else if (verbose > 2) { rprintf(FINFO, "make_backup: DEVICE %s successful.\n", - safe_fname(fname)); + fname); } kept = 1; do_unlink(fname); @@ -235,7 +234,7 @@ static int keep_backup(char *fname) || do_symlink(file->u.link, buf) < 0)) { rsyserr(FERROR, errno, "link %s -> \"%s\"", full_fname(buf), - safe_fname(file->u.link)); + file->u.link); } do_unlink(fname); kept = 1; @@ -245,7 +244,7 @@ static int keep_backup(char *fname) if (!kept && !S_ISREG(file->mode)) { rprintf(FINFO, "make_bak: skipping non-regular file %s\n", - safe_fname(fname)); + fname); return 1; } @@ -253,7 +252,7 @@ static int keep_backup(char *fname) if (!kept) { if (robust_move(fname, buf) != 0) { rsyserr(FERROR, errno, "keep_backup failed: %s -> \"%s\"", - full_fname(fname), safe_fname(buf)); + full_fname(fname), buf); } else if (st.st_nlink > 1) { /* If someone has hard-linked the file into the backup * dir, rename() might return success but do nothing! */ @@ -265,7 +264,7 @@ static int keep_backup(char *fname) if (verbose > 1) { rprintf(FINFO, "backed up %s to %s\n", - safe_fname(fname), safe_fname(buf)); + fname, buf); } return 1; } diff --git a/batch.c b/batch.c index eb0c49a4..46466a00 100644 --- a/batch.c +++ b/batch.c @@ -165,7 +165,7 @@ void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt) S_IRUSR | S_IWUSR | S_IEXEC); if (fd < 0) { rsyserr(FERROR, errno, "Batch file %s open error", - safe_fname(filename)); + filename); exit_cleanup(1); } @@ -211,7 +211,7 @@ void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt) write_filter_rules(fd); if (write(fd, "\n", 1) != 1 || close(fd) < 0) { rsyserr(FERROR, errno, "Batch file %s write error", - safe_fname(filename)); + filename); exit_cleanup(1); } } @@ -229,14 +229,14 @@ void show_flist(int index, struct file_struct **fptr) (double) fptr[i]->length); rprintf(FINFO, "flist->mode=%#o\n", (int) fptr[i]->mode); rprintf(FINFO, "flist->basename=%s\n", - safe_fname(fptr[i]->basename)); + fptr[i]->basename); if (fptr[i]->dirname) { rprintf(FINFO, "flist->dirname=%s\n", - safe_fname(fptr[i]->dirname)); + fptr[i]->dirname); } if (am_sender && fptr[i]->dir.root) { rprintf(FINFO, "flist->dir.root=%s\n", - safe_fname(fptr[i]->dir.root)); + fptr[i]->dir.root); } } } @@ -248,5 +248,5 @@ void show_argvs(int argc, char *argv[]) rprintf(FINFO, "BATCH.C:show_argvs,argc=%d\n", argc); for (i = 0; i < argc; i++) - rprintf(FINFO, "i=%d,argv[i]=%s\n", i, safe_fname(argv[i])); + rprintf(FINFO, "i=%d,argv[i]=%s\n", i, argv[i]); } diff --git a/cleanup.c b/cleanup.c index 8d490ef8..bb589e48 100644 --- a/cleanup.c +++ b/cleanup.c @@ -99,7 +99,7 @@ void _exit_cleanup(int code, const char *file, int line) if (verbose > 3) { rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): entered\n", - code, safe_fname(file), line); + code, file, line); } if (cleanup_child_pid != -1) { @@ -149,7 +149,7 @@ void _exit_cleanup(int code, const char *file, int line) if (verbose > 2) { rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): about to call exit(%d)\n", - ocode, safe_fname(file), line, code); + ocode, file, line, code); } close_all(); diff --git a/clientserver.c b/clientserver.c index f3adfe97..978135d1 100644 --- a/clientserver.c +++ b/clientserver.c @@ -297,7 +297,7 @@ static int rsync_module(int f_in, int f_out, int i) if (!claim_connection(lp_lock_file(i), lp_max_connections(i))) { if (errno) { rsyserr(FLOG, errno, "failed to open lock file %s", - safe_fname(lp_lock_file(i))); + lp_lock_file(i)); io_printf(f_out, "@ERROR: failed to open lock file\n"); } else { rprintf(FLOG, "max connections (%d) reached\n", @@ -494,14 +494,14 @@ static int rsync_module(int f_in, int f_out, int i) */ if (chroot(lp_path(i))) { rsyserr(FLOG, errno, "chroot %s failed", - safe_fname(lp_path(i))); + lp_path(i)); io_printf(f_out, "@ERROR: chroot failed\n"); return -1; } if (!push_dir("/")) { rsyserr(FLOG, errno, "chdir %s failed\n", - safe_fname(lp_path(i))); + lp_path(i)); io_printf(f_out, "@ERROR: chdir failed\n"); return -1; } @@ -509,7 +509,7 @@ static int rsync_module(int f_in, int f_out, int i) } else { if (!push_dir(lp_path(i))) { rsyserr(FLOG, errno, "chdir %s failed\n", - safe_fname(lp_path(i))); + lp_path(i)); io_printf(f_out, "@ERROR: chdir failed\n"); return -1; } @@ -822,7 +822,7 @@ int daemon_main(void) 0666 & ~orig_umask)) == -1) { cleanup_set_pid(0); rsyserr(FLOG, errno, "failed to create pid file %s", - safe_fname(pid_file)); + pid_file); exit_cleanup(RERR_FILEIO); } snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid); diff --git a/exclude.c b/exclude.c index 8d748641..1740f7b4 100644 --- a/exclude.c +++ b/exclude.c @@ -302,7 +302,7 @@ static char *parse_merge_name(const char *merge_file, unsigned int *len_ptr, } if (!sanitize_path(fn, merge_file, r, dirbuf_depth)) { rprintf(FERROR, "merge-file name overflows: %s\n", - safe_fname(merge_file)); + merge_file); return NULL; } } else { @@ -315,8 +315,7 @@ static char *parse_merge_name(const char *merge_file, unsigned int *len_ptr, goto done; if (dirbuf_len + fn_len >= MAXPATHLEN) { - rprintf(FERROR, "merge-file name overflows: %s\n", - safe_fname(fn)); + rprintf(FERROR, "merge-file name overflows: %s\n", fn); return NULL; } memcpy(buf, dirbuf + prefix_skip, dirbuf_len - prefix_skip); @@ -985,7 +984,7 @@ void parse_filter_file(struct filter_list_struct *listp, const char *fname, if (verbose > 2) { rprintf(FINFO, "[%s] parse_filter_file(%s,%x,%x)%s\n", - who_am_i(), safe_fname(fname), mflags, xflags, + who_am_i(), fname, mflags, xflags, fp ? "" : " [not found]"); } @@ -994,7 +993,7 @@ void parse_filter_file(struct filter_list_struct *listp, const char *fname, rsyserr(FERROR, errno, "failed to open %sclude file %s", mflags & MATCHFLG_INCLUDE ? "in" : "ex", - safe_fname(fname)); + fname); exit_cleanup(RERR_FILEIO); } return; diff --git a/generator.c b/generator.c index bbbc05f6..82040c1a 100644 --- a/generator.c +++ b/generator.c @@ -236,7 +236,7 @@ static void delete_in_dir(struct file_list *flist, char *fbuf, } if (verbose > 2) - rprintf(FINFO, "delete_in_dir(%s)\n", safe_fname(fbuf)); + rprintf(FINFO, "delete_in_dir(%s)\n", fbuf); if (allowed_lull) maybe_send_keepalive(); @@ -308,7 +308,7 @@ static void do_delete_pass(struct file_list *flist) f_name_to(file, fbuf); if (verbose > 1 && file->flags & FLAG_TOP_DIR) - rprintf(FINFO, "deleting in %s\n", safe_fname(fbuf)); + rprintf(FINFO, "deleting in %s\n", fbuf); delete_in_dir(flist, fbuf, file); } @@ -665,7 +665,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx, if (verbose > 1 && maybe_PERMS_REPORT) { code = daemon_log_format_has_i || dry_run ? FCLIENT : FINFO; - rprintf(code, "%s is uptodate\n", safe_fname(fname)); + rprintf(code, "%s is uptodate\n", fname); } return -2; } @@ -676,7 +676,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx, if (copy_file(cmpbuf, fname, file->mode) < 0) { if (verbose) { rsyserr(FINFO, errno, "copy_file %s => %s", - full_fname(cmpbuf), safe_fname(fname)); + full_fname(cmpbuf), fname); } return -1; } @@ -688,7 +688,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx, || (verbose > 1 && match_level == 3))) { code = daemon_log_format_has_i || dry_run ? FCLIENT : FINFO; - rprintf(code, "%s%s\n", safe_fname(fname), + rprintf(code, "%s%s\n", fname, match_level == 3 ? " is uptodate" : ""); } if (preserve_hard_links && file->link_u.links) @@ -742,7 +742,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, if (verbose > 1 && maybe_PERMS_REPORT) { code = daemon_log_format_has_i || dry_run ? FCLIENT : FINFO; - rprintf(code, "%s is uptodate\n", safe_fname(fname)); + rprintf(code, "%s is uptodate\n", fname); } return -2; } while (basis_dir[++i] != NULL); @@ -794,10 +794,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, return; } - if (verbose > 2) { - rprintf(FINFO, "recv_generator(%s,%d)\n", - safe_fname(fname), ndx); - } + if (verbose > 2) + rprintf(FINFO, "recv_generator(%s,%d)\n", fname, ndx); if (server_filter_list.head) { if (excluded_below >= 0) { @@ -813,7 +811,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (verbose) { rprintf(FINFO, "skipping server-excluded file \"%s\"\n", - safe_fname(fname)); + fname); } return; } @@ -847,7 +845,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (verbose > 1) { rprintf(FINFO, "not creating new %s \"%s\"\n", S_ISDIR(file->mode) ? "directory" : "file", - safe_fname(fname)); + fname); } return; } @@ -891,7 +889,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } if (set_perms(fname, file, statret ? NULL : &st, 0) && verbose && code && f_out != -1) - rprintf(code, "%s/\n", safe_fname(fname)); + rprintf(code, "%s/\n", fname); if (delete_during && f_out != -1 && !phase && dry_run < 2 && (file->flags & FLAG_DEL_HERE)) delete_in_dir(the_file_list, fname, file); @@ -911,8 +909,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, fname = f_name(file); rprintf(FINFO, "ignoring unsafe symlink %s -> \"%s\"\n", - full_fname(fname), - safe_fname(file->u.link)); + full_fname(fname), file->u.link); } return; } @@ -963,7 +960,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, return; if (do_symlink(file->u.link,fname) != 0) { rsyserr(FERROR, errno, "symlink %s -> \"%s\" failed", - full_fname(fname), safe_fname(file->u.link)); + full_fname(fname), file->u.link); } else { set_perms(fname,file,NULL,0); if (itemizing) { @@ -971,8 +968,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, ITEM_LOCAL_CHANGE, 0, NULL); } if (code && verbose) { - rprintf(code, "%s -> %s\n", safe_fname(fname), - safe_fname(file->u.link)); + rprintf(code, "%s -> %s\n", fname, + file->u.link); } if (remove_sent_files && !dry_run) { char numbuf[4]; @@ -1011,7 +1008,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, statret = -1; if (verbose > 2) { rprintf(FINFO,"mknod(%s,0%o,0x%x)\n", - safe_fname(fname), + fname, (int)file->mode, (int)file->u.rdev); } if (do_mknod(fname,file->mode,file->u.rdev) < 0) { @@ -1023,10 +1020,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, itemize(file, ndx, statret, &st, ITEM_LOCAL_CHANGE, 0, NULL); } - if (code && verbose) { - rprintf(code, "%s\n", - safe_fname(fname)); - } + if (code && verbose) + rprintf(code, "%s\n", fname); if (preserve_hard_links && file->link_u.links) { hard_link_cluster(file, ndx, itemizing, code); @@ -1045,8 +1040,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (!S_ISREG(file->mode)) { if (the_file_list->count == 1) fname = f_name(file); - rprintf(FINFO, "skipping non-regular file \"%s\"\n", - safe_fname(fname)); + rprintf(FINFO, "skipping non-regular file \"%s\"\n", fname); return; } @@ -1054,8 +1048,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (verbose > 1) { if (the_file_list->count == 1) fname = f_name(file); - rprintf(FINFO, "%s is over max-size\n", - safe_fname(fname)); + rprintf(FINFO, "%s is over max-size\n", fname); } return; } @@ -1063,22 +1056,21 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (verbose > 1) { if (the_file_list->count == 1) fname = f_name(file); - rprintf(FINFO, "%s is under min-size\n", - safe_fname(fname)); + rprintf(FINFO, "%s is under min-size\n", fname); } return; } if (ignore_existing && statret == 0) { if (verbose > 1) - rprintf(FINFO, "%s exists\n", safe_fname(fname)); + rprintf(FINFO, "%s exists\n", fname); return; } if (update_only && statret == 0 && cmp_modtime(st.st_mtime, file->modtime) > 0) { if (verbose > 1) - rprintf(FINFO, "%s is newer\n", safe_fname(fname)); + rprintf(FINFO, "%s is newer\n", fname); return; } @@ -1122,7 +1114,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, f_name_to(fuzzy_file, fnamecmpbuf); if (verbose > 2) { rprintf(FINFO, "fuzzy basis selected for %s: %s\n", - safe_fname(fname), safe_fname(fnamecmpbuf)); + fname, fnamecmpbuf); } st.st_size = fuzzy_file->length; statret = 0; @@ -1227,7 +1219,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (verbose > 3) { rprintf(FINFO, "gen mapped %s of size %.0f\n", - safe_fname(fnamecmp), (double)st.st_size); + fnamecmp, (double)st.st_size); } if (verbose > 2) @@ -1267,7 +1259,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, set_perms(backupptr, back_file, NULL, 0); if (verbose > 1) { rprintf(FINFO, "backed up %s to %s\n", - safe_fname(fname), safe_fname(backupptr)); + fname, backupptr); } free(back_file); } diff --git a/hlink.c b/hlink.c index 1669da16..f4fa9fcb 100644 --- a/hlink.c +++ b/hlink.c @@ -181,10 +181,8 @@ int hard_link_check(struct file_struct *file, int ndx, char *fname, head = hlink_list[file->F_HLINDEX]; if (ndx != head) { struct file_struct *head_file = FPTR(head); - if (!log_format_has_i && verbose > 1) { - rprintf(FINFO, "\"%s\" is a hard link\n", - safe_fname(f_name(file))); - } + if (!log_format_has_i && verbose > 1) + rprintf(FINFO, "\"%s\" is a hard link\n", f_name(file)); if (head_file->F_HLINDEX == FINISHED_LINK) { STRUCT_STAT st2, st3; char *toname = f_name(head_file); @@ -242,7 +240,7 @@ int hard_link_one(struct file_struct *file, int ndx, char *fname, } else code = FERROR; rsyserr(code, errno, "link %s => %s failed", - full_fname(fname), safe_fname(toname)); + full_fname(fname), toname); return -1; } @@ -251,10 +249,8 @@ int hard_link_one(struct file_struct *file, int ndx, char *fname, ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0, terse ? "" : toname); } - if (code && verbose && !terse) { - rprintf(code, "%s => %s\n", - safe_fname(fname), safe_fname(toname)); - } + if (code && verbose && !terse) + rprintf(code, "%s => %s\n", fname, toname); return 0; } #endif diff --git a/main.c b/main.c index f609bd7d..d4963b1b 100644 --- a/main.c +++ b/main.c @@ -393,7 +393,7 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char *path, if (verbose > 3) { for (i = 0; i < argc; i++) - rprintf(FINFO, "cmd[%d]=%s ", i, safe_fname(args[i])); + rprintf(FINFO, "cmd[%d]=%s ", i, args[i]); rprintf(FINFO, "\n"); } @@ -463,7 +463,7 @@ static char *get_local_name(struct file_list *flist,char *name) exit_cleanup(RERR_FILEIO); } if (verbose > 0) - rprintf(FINFO, "created directory %s\n", safe_fname(name)); + rprintf(FINFO, "created directory %s\n", name); if (dry_run) { dry_run++; @@ -974,10 +974,10 @@ static int start_client(int argc, char *argv[]) if (verbose > 3) { rprintf(FINFO,"cmd=%s machine=%s user=%s path=%s\n", - shell_cmd ? safe_fname(shell_cmd) : "", - shell_machine ? safe_fname(shell_machine) : "", - shell_user ? safe_fname(shell_user) : "", - shell_path ? safe_fname(shell_path) : ""); + shell_cmd ? shell_cmd : "", + shell_machine ? shell_machine : "", + shell_user ? shell_user : "", + shell_path ? shell_path : ""); } /* for remote source, only single dest arg can remain ... */ diff --git a/params.c b/params.c index f48ed0f2..95981464 100644 --- a/params.c +++ b/params.c @@ -492,7 +492,7 @@ static FILE *OpenConfFile( char *FileName ) if( NULL == OpenedFile ) { rsyserr(FERROR, errno, "rsync: unable to open configuration file \"%s\"", - safe_fname(FileName)); + FileName); } return( OpenedFile ); diff --git a/pipe.c b/pipe.c index a0704bc7..d4bf1134 100644 --- a/pipe.c +++ b/pipe.c @@ -78,8 +78,7 @@ pid_t piped_child(char **command, int *f_in, int *f_out) if (blocking_io > 0) set_blocking(STDOUT_FILENO); execvp(command[0], command); - rsyserr(FERROR, errno, "Failed to exec %s", - safe_fname(command[0])); + rsyserr(FERROR, errno, "Failed to exec %s", command[0]); exit_cleanup(RERR_IPC); } diff --git a/receiver.c b/receiver.c index 805f0f6c..db4f7f89 100644 --- a/receiver.c +++ b/receiver.c @@ -173,8 +173,7 @@ static int get_tmpname(char *fnametmp, char *fname) maxname = MIN(MAXPATHLEN - 7 - length, NAME_MAX - 8); if (maxname < 1) { - rprintf(FERROR, "temporary filename too long: %s\n", - safe_fname(fname)); + rprintf(FERROR, "temporary filename too long: %s\n", fname); fnametmp[0] = '\0'; return 0; } @@ -207,7 +206,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, mapbuf = map_file(fd_r, size_r, read_size, sum.blength); if (verbose > 2) { rprintf(FINFO, "recv mapped %s of size %.0f\n", - safe_fname(fname_r), (double)size_r); + fname_r, (double)size_r); } } else mapbuf = NULL; @@ -351,16 +350,14 @@ static void handle_delayed_updates(struct file_list *flist, char *local_name) continue; if (verbose > 2) { rprintf(FINFO, "renaming %s to %s\n", - safe_fname(partialptr), - safe_fname(fname)); + partialptr, fname); } /* We don't use robust_rename() here because the * partial-dir must be on the same drive. */ if (do_rename(partialptr, fname) < 0) { rsyserr(FERROR, errno, "rename failed for %s (from %s)", - full_fname(fname), - safe_fname(partialptr)); + full_fname(fname), partialptr); } else { if (remove_sent_files || (preserve_hard_links @@ -368,8 +365,7 @@ static void handle_delayed_updates(struct file_list *flist, char *local_name) SIVAL(numbuf, 0, i); send_msg(MSG_SUCCESS,numbuf,4); } - handle_partial_dir(partialptr, - PDIR_DELETE); + handle_partial_dir(partialptr, PDIR_DELETE); } } } @@ -382,7 +378,7 @@ static int get_next_gen_i(int batch_gen_fd, int next_gen_i, int desired_i) rprintf(FINFO, "(No batched update for%s \"%s\")\n", phase ? " resend of" : "", - safe_fname(f_name(the_file_list->files[next_gen_i]))); + f_name(the_file_list->files[next_gen_i])); } next_gen_i = read_int(batch_gen_fd); if (next_gen_i == -1) @@ -463,7 +459,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) fname = local_name ? local_name : f_name_to(file, fbuf); if (verbose > 2) - rprintf(FINFO, "recv_files(%s)\n", safe_fname(fname)); + rprintf(FINFO, "recv_files(%s)\n", fname); if (!(iflags & ITEM_TRANSFER)) { maybe_log_item(file, iflags, itemizing, xname); @@ -504,8 +500,9 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) if (read_batch) { next_gen_i = get_next_gen_i(batch_gen_fd, next_gen_i, i); if (i < next_gen_i) { - rprintf(FINFO, "(Skipping batched update for \"%s\")\n", - safe_fname(fname)); + rprintf(FINFO, + "(Skipping batched update for \"%s\")\n", + fname); discard_receive_data(f_in, file->length); continue; } @@ -666,7 +663,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) if (log_before_transfer) log_item(file, &initial_stats, iflags, NULL); else if (!am_server && verbose && do_progress) - rprintf(FINFO, "%s\n", safe_fname(fname)); + rprintf(FINFO, "%s\n", fname); /* recv file data */ recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size, @@ -729,8 +726,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name) } rprintf(msgtype, "%s: %s failed verification -- update %s%s.\n", - errstr, safe_fname(fname), - keptstr, redostr); + errstr, fname, keptstr, redostr); } if (!phase) { SIVAL(numbuf, 0, i); diff --git a/rsync.c b/rsync.c index 6d2812c5..9964c67e 100644 --- a/rsync.c +++ b/rsync.c @@ -95,13 +95,13 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st, if (change_uid) { rprintf(FINFO, "set uid of %s from %ld to %ld\n", - safe_fname(fname), + fname, (long)st->st_uid, (long)file->uid); } if (change_gid) { rprintf(FINFO, "set gid of %s from %ld to %ld\n", - safe_fname(fname), + fname, (long)st->st_gid, (long)file->gid); } } @@ -143,9 +143,9 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st, enum logcode code = daemon_log_format_has_i || dry_run ? FCLIENT : FINFO; if (updated) - rprintf(code, "%s\n", safe_fname(fname)); + rprintf(code, "%s\n", fname); else - rprintf(code, "%s is uptodate\n", safe_fname(fname)); + rprintf(code, "%s is uptodate\n", fname); } return updated; } @@ -175,7 +175,7 @@ void finish_transfer(char *fname, char *fnametmp, struct file_struct *file, if (inplace) { if (verbose > 2) - rprintf(FINFO, "finishing %s\n", safe_fname(fname)); + rprintf(FINFO, "finishing %s\n", fname); goto do_set_perms; } @@ -186,15 +186,13 @@ void finish_transfer(char *fname, char *fnametmp, struct file_struct *file, set_perms(fnametmp, file, NULL, ok_to_set_time ? 0 : PERMS_SKIP_MTIME); /* move tmp file over real file */ - if (verbose > 2) { - rprintf(FINFO, "renaming %s to %s\n", - safe_fname(fnametmp), safe_fname(fname)); - } + if (verbose > 2) + rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname); ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS); if (ret < 0) { rsyserr(FERROR, errno, "%s %s -> \"%s\"", - ret == -2 ? "copy" : "rename", - full_fname(fnametmp), safe_fname(fname)); + ret == -2 ? "copy" : "rename", + full_fname(fnametmp), fname); do_unlink(fnametmp); return; } diff --git a/sender.c b/sender.c index b19ecb54..c593d818 100644 --- a/sender.c +++ b/sender.c @@ -134,10 +134,8 @@ void successful_send(int ndx) } else offset = 0; f_name_to(file, fname + offset); - if (remove_sent_files && do_unlink(fname) == 0 && verbose > 1) { - rprintf(FINFO, "sender removed %s\n", - safe_fname(fname + offset)); - } + if (remove_sent_files && do_unlink(fname) == 0 && verbose > 1) + rprintf(FINFO, "sender removed %s\n", fname + offset); } static void write_ndx_and_attrs(int f_out, int ndx, int iflags, @@ -331,22 +329,20 @@ void send_files(struct file_list *flist, int f_out, int f_in) if (verbose > 2) { rprintf(FINFO, "send_files mapped %s of size %.0f\n", - safe_fname(fname), (double)st.st_size); + fname, (double)st.st_size); } write_ndx_and_attrs(f_out, i, iflags, fnamecmp_type, xname, xlen); write_sum_head(f_xfer, s); - if (verbose > 2) { - rprintf(FINFO, "calling match_sums %s\n", - safe_fname(fname)); - } + if (verbose > 2) + rprintf(FINFO, "calling match_sums %s\n", fname); if (log_before_transfer) log_item(file, &initial_stats, iflags, NULL); else if (!am_server && verbose && do_progress) - rprintf(FINFO, "%s\n", safe_fname(fname2)); + rprintf(FINFO, "%s\n", fname2); set_compression(fname); @@ -370,10 +366,8 @@ void send_files(struct file_list *flist, int f_out, int f_in) free_sums(s); - if (verbose > 2) { - rprintf(FINFO, "sender finished %s\n", - safe_fname(fname)); - } + if (verbose > 2) + rprintf(FINFO, "sender finished %s\n", fname); /* Flag that we actually sent this entry. */ file->flags |= FLAG_SENT; -- 2.34.1