Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug reported by engard.ferenc at innomed.hu whereby using the %f format
[rsync/rsync.git]
/
flist.c
diff --git
a/flist.c
b/flist.c
index
11aeef0
..
2fff9cf
100644
(file)
--- a/
flist.c
+++ b/
flist.c
@@
-41,6
+41,8
@@
extern int always_checksum;
extern int cvs_exclude;
extern int recurse;
extern int cvs_exclude;
extern int recurse;
+extern char *files_from;
+extern int filesfrom_fd;
extern int one_file_system;
extern int make_backups;
extern int one_file_system;
extern int make_backups;
@@
-52,6
+54,7
@@
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_times;
extern int relative_paths;
extern int preserve_gid;
extern int preserve_times;
extern int relative_paths;
+extern int implied_dirs;
extern int copy_links;
extern int copy_unsafe_links;
extern int remote_version;
extern int copy_links;
extern int copy_unsafe_links;
extern int remote_version;
@@
-70,7
+73,7
@@
static void clean_flist(struct file_list *flist, int strip_root, int no_dups);
static int show_filelist_p(void)
{
static int show_filelist_p(void)
{
- return verbose &&
recurse
&& !am_server;
+ return verbose &&
(recurse || files_from)
&& !am_server;
}
static void start_filelist_progress(char *kind)
}
static void start_filelist_progress(char *kind)
@@
-681,7
+684,7
@@
struct file_struct *make_file(int f, char *fname, struct string_area **ap,
if (noexcludes)
goto skip_excludes;
if (noexcludes)
goto skip_excludes;
- if (S_ISDIR(st.st_mode) && !recurse) {
+ if (S_ISDIR(st.st_mode) && !recurse
&& !files_from
) {
rprintf(FINFO, "skipping directory %s\n", fname);
return NULL;
}
rprintf(FINFO, "skipping directory %s\n", fname);
return NULL;
}
@@
-877,12
+880,13
@@
static void send_directory(int f, struct file_list *flist, char *dir)
**/
struct file_list *send_file_list(int f, int argc, char *argv[])
{
**/
struct file_list *send_file_list(int f, int argc, char *argv[])
{
- int
i,
l;
+ int l;
STRUCT_STAT st;
char *p, *dir, *olddir;
char lastpath[MAXPATHLEN] = "";
struct file_list *flist;
int64 start_write;
STRUCT_STAT st;
char *p, *dir, *olddir;
char lastpath[MAXPATHLEN] = "";
struct file_list *flist;
int64 start_write;
+ int use_ff_fd = 0;
if (show_filelist_p() && f != -1)
start_filelist_progress("building file list");
if (show_filelist_p() && f != -1)
start_filelist_progress("building file list");
@@
-893,13
+897,31
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
if (f != -1) {
io_start_buffering(f);
if (f != -1) {
io_start_buffering(f);
+ if (filesfrom_fd >= 0) {
+ if (argv[0] && !push_dir(argv[0], 0)) {
+ rprintf(FERROR, "push_dir %s : %s\n",
+ argv[0], strerror(errno));
+ exit_cleanup(RERR_FILESELECT);
+ }
+ use_ff_fd = 1;
+ }
}
}
-
for (i = 0; i < argc; i++
) {
+
while (1
) {
char fname2[MAXPATHLEN];
char *fname = fname2;
char fname2[MAXPATHLEN];
char *fname = fname2;
- strlcpy(fname, argv[i], MAXPATHLEN);
+ if (use_ff_fd) {
+ if (read_filesfrom_line(filesfrom_fd, fname) == 0)
+ break;
+ sanitize_path(fname, NULL);
+ } else {
+ if (argc-- == 0)
+ break;
+ strlcpy(fname, *argv++, MAXPATHLEN);
+ if (sanitize_paths)
+ sanitize_path(fname, NULL);
+ }
l = strlen(fname);
if (l != 1 && fname[l - 1] == '/') {
l = strlen(fname);
if (l != 1 && fname[l - 1] == '/') {
@@
-924,7
+946,7
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
continue;
}
continue;
}
- if (S_ISDIR(st.st_mode) && !recurse) {
+ if (S_ISDIR(st.st_mode) && !recurse
&& !files_from
) {
rprintf(FINFO, "skipping directory %s\n", fname);
continue;
}
rprintf(FINFO, "skipping directory %s\n", fname);
continue;
}
@@
-942,7
+964,7
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
dir = fname;
fname = p + 1;
}
dir = fname;
fname = p + 1;
}
- } else if (f != -1 && (p=strrchr(fname,'/')) && p != fname) {
+ } else if (f != -1 &&
implied_dirs &&
(p=strrchr(fname,'/')) && p != fname) {
/* this ensures we send the intermediate directories,
thus getting their permissions right */
char *lp = lastpath, *fn = fname, *slash = fname;
/* this ensures we send the intermediate directories,
thus getting their permissions right */
char *lp = lastpath, *fn = fname, *slash = fname;
@@
-1020,7
+1042,7
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
/* now send the uid/gid list. This was introduced in protocol
version 15 */
/* now send the uid/gid list. This was introduced in protocol
version 15 */
- if (f != -1
&& remote_version >= 15
) {
+ if (f != -1) {
send_uid_list(f);
}
send_uid_list(f);
}
@@
-1100,7
+1122,7
@@
struct file_list *recv_file_list(int f)
}
/* now recv the uid/gid list. This was introduced in protocol version 15 */
}
/* now recv the uid/gid list. This was introduced in protocol version 15 */
- if (f != -1
&& remote_version >= 15
) {
+ if (f != -1) {
recv_uid_list(f, flist);
}
recv_uid_list(f, flist);
}