mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-21 05:14:15 -04:00
Got rid of calls to the (soon to vanish) safe_fname() function.
This commit is contained in:
1 parent
7543020807
commit
0ee6ca9800
4 files changed
+30
-39
No files matched your search
@@ -143,14 +143,14 @@ static void list_file_entry(struct file_struct *f)
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ static int readlink_stat(const char *path, STRUCT_STAT *buffer, char *linkbuf)
|
||||
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);
|
||||
}
|
||||
@@ -534,7 +534,7 @@ static struct file_struct *receive_file_entry(struct file_list *flist,
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -752,8 +752,7 @@ struct file_struct *make_file(char *fname, struct file_list *flist,
|
||||
|
||||
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);
|
||||
@@ -798,7 +797,7 @@ struct file_struct *make_file(char *fname, struct file_list *flist,
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -824,7 +823,7 @@ struct file_struct *make_file(char *fname, struct file_list *flist,
|
||||
|
||||
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) {
|
||||
@@ -1031,14 +1030,14 @@ static void send_directory(int f, struct file_list *flist,
|
||||
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';
|
||||
@@ -1136,8 +1135,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1330,10 +1328,8 @@ struct file_list *recv_file_list(int f)
|
||||
|
||||
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. */
|
||||
|
||||
@@ -1524,7 +1520,7 @@ static void clean_flist(struct file_list *flist, int strip_root, int no_dups)
|
||||
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. */
|
||||
@@ -1588,7 +1584,7 @@ static void output_flist(struct file_list *flist)
|
||||
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);
|
||||
@@ -1757,6 +1753,7 @@ char *f_name_to(struct file_struct *f, char *fbuf)
|
||||
strcpy(fbuf + len + 1, f->basename);
|
||||
} else
|
||||
strcpy(fbuf, f->basename);
|
||||
|
||||
return fbuf;
|
||||
}
|
||||
|
||||
|
||||
@@ -427,35 +427,31 @@ static void log_formatted(enum logcode code, char *format, char *op,
|
||||
n = op;
|
||||
break;
|
||||
case 'f':
|
||||
n = safe_fname(f_name(file));
|
||||
n = f_name(file);
|
||||
if (am_sender && file->dir.root) {
|
||||
pathjoin(buf2, sizeof buf2,
|
||||
file->dir.root, n);
|
||||
/* The buffer from safe_fname() has more
|
||||
* room than MAXPATHLEN, so this is safe. */
|
||||
clean_fname(buf2, 0);
|
||||
if (fmt[1])
|
||||
strcpy(n, buf2);
|
||||
strlcpy(n, buf2, MAXPATHLEN);
|
||||
else
|
||||
n = buf2;
|
||||
}
|
||||
clean_fname(n, 0);
|
||||
} else
|
||||
clean_fname(n, 0);
|
||||
if (*n == '/')
|
||||
n++;
|
||||
break;
|
||||
case 'n':
|
||||
n = safe_fname(f_name(file));
|
||||
if (S_ISDIR(file->mode)) {
|
||||
/* The buffer from safe_fname() has more
|
||||
* room than MAXPATHLEN, so this is safe. */
|
||||
strcat(n, "/");
|
||||
}
|
||||
n = f_name(file);
|
||||
if (S_ISDIR(file->mode))
|
||||
strlcat(n, "/", MAXPATHLEN);
|
||||
break;
|
||||
case 'L':
|
||||
if (hlink && *hlink) {
|
||||
n = safe_fname(hlink);
|
||||
n = hlink;
|
||||
strcpy(buf2, " => ");
|
||||
} else if (S_ISLNK(file->mode) && file->u.link) {
|
||||
n = safe_fname(file->u.link);
|
||||
n = file->u.link;
|
||||
strcpy(buf2, " -> ");
|
||||
} else {
|
||||
n = "";
|
||||
|
||||
@@ -1199,10 +1199,8 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
|
||||
backup_dir_buf[backup_dir_len++] = '/';
|
||||
backup_dir_buf[backup_dir_len] = '\0';
|
||||
}
|
||||
if (verbose > 1 && !am_sender) {
|
||||
rprintf(FINFO, "backup_dir is %s\n",
|
||||
safe_fname(backup_dir_buf));
|
||||
}
|
||||
if (verbose > 1 && !am_sender)
|
||||
rprintf(FINFO, "backup_dir is %s\n", backup_dir_buf);
|
||||
} else if (!backup_suffix_len && (!am_server || !am_sender)) {
|
||||
snprintf(err_buf, sizeof err_buf,
|
||||
"--suffix cannot be a null string without --backup-dir\n");
|
||||
@@ -1217,7 +1215,7 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
|
||||
|
||||
if (chmod_mode && !(chmod_modes = parse_chmod(chmod_mode))) {
|
||||
snprintf(err_buf, sizeof err_buf,
|
||||
"Invalid argument passed to chmod\n");
|
||||
"Invalid argument passed to --chmod\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -794,7 +794,7 @@ extern int errno;
|
||||
#define INITACCESSPERMS 0700
|
||||
|
||||
/* handler for null strings in printf format */
|
||||
#define NS(s) ((s)?safe_fname(s):"<NULL>")
|
||||
#define NS(s) ((s)?(s):"<NULL>")
|
||||
|
||||
#if !defined __GNUC__ || defined __APPLE__
|
||||
/* Apparently the OS X port of gcc gags on __attribute__.
|
||||
|
||||
Reference in new issue
Block a user