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
Actually, since the close calls shouldn't fail (now that listener
[rsync/rsync.git]
/
flist.c
diff --git
a/flist.c
b/flist.c
index
1a24abf
..
4e0af36
100644
(file)
--- a/
flist.c
+++ b/
flist.c
@@
-64,9
+64,6
@@
extern int delete_excluded;
extern int orig_umask;
extern int list_only;
extern int orig_umask;
extern int list_only;
-extern int read_batch;
-extern int write_batch;
-
extern struct exclude_list_struct exclude_list;
extern struct exclude_list_struct server_exclude_list;
extern struct exclude_list_struct local_exclude_list;
extern struct exclude_list_struct exclude_list;
extern struct exclude_list_struct server_exclude_list;
extern struct exclude_list_struct local_exclude_list;
@@
-534,7
+531,7
@@
void receive_file_entry(struct file_struct **fptr, unsigned short flags,
static uid_t uid;
static gid_t gid;
static char lastname[MAXPATHLEN], *lastdir;
static uid_t uid;
static gid_t gid;
static char lastname[MAXPATHLEN], *lastdir;
- static int lastdir_len = -1;
+ static int lastdir_
depth, lastdir_
len = -1;
char thisname[MAXPATHLEN];
unsigned int l1 = 0, l2 = 0;
int alloc_len, basename_len, dirname_len, linkname_len, sum_len;
char thisname[MAXPATHLEN];
unsigned int l1 = 0, l2 = 0;
int alloc_len, basename_len, dirname_len, linkname_len, sum_len;
@@
-573,10
+570,10
@@
void receive_file_entry(struct file_struct **fptr, unsigned short flags,
strlcpy(lastname, thisname, MAXPATHLEN);
strlcpy(lastname, thisname, MAXPATHLEN);
- clean_fname(thisname);
+ clean_fname(thisname
, 0
);
if (sanitize_paths)
if (sanitize_paths)
- sanitize_path(thisname,
NULL
);
+ sanitize_path(thisname,
thisname, "", 0
);
if ((basename = strrchr(thisname, '/')) != NULL) {
dirname_len = ++basename - thisname; /* counts future '\0' */
if ((basename = strrchr(thisname, '/')) != NULL) {
dirname_len = ++basename - thisname; /* counts future '\0' */
@@
-659,6
+656,8
@@
void receive_file_entry(struct file_struct **fptr, unsigned short flags,
memcpy(bp, dirname, dirname_len - 1);
bp += dirname_len;
bp[-1] = '\0';
memcpy(bp, dirname, dirname_len - 1);
bp += dirname_len;
bp[-1] = '\0';
+ if (sanitize_paths)
+ lastdir_depth = count_dir_elements(lastdir);
} else if (dirname)
file->dirname = dirname;
} else if (dirname)
file->dirname = dirname;
@@
-674,7
+673,7
@@
void receive_file_entry(struct file_struct **fptr, unsigned short flags,
file->u.link = bp;
read_sbuf(f, bp, linkname_len - 1);
if (sanitize_paths)
file->u.link = bp;
read_sbuf(f, bp, linkname_len - 1);
if (sanitize_paths)
- sanitize_path(bp,
lastdir
);
+ sanitize_path(bp,
bp, "", lastdir_depth
);
bp += linkname_len;
}
#endif
bp += linkname_len;
}
#endif
@@
-762,9
+761,9
@@
struct file_struct *make_file(char *fname, struct file_list *flist,
rprintf(FINFO, "skipping overly long name: %s\n", fname);
return NULL;
}
rprintf(FINFO, "skipping overly long name: %s\n", fname);
return NULL;
}
- clean_fname(thisname);
+ clean_fname(thisname
, 0
);
if (sanitize_paths)
if (sanitize_paths)
- sanitize_path(thisname,
NULL
);
+ sanitize_path(thisname,
thisname, "", 0
);
memset(sum, 0, SUM_LENGTH);
memset(sum, 0, SUM_LENGTH);
@@
-950,9
+949,6
@@
void send_file_name(int f, struct file_list *flist, char *fname,
flist_expand(flist);
flist_expand(flist);
- if (write_batch)
- file->flags |= FLAG_TOP_DIR;
-
if (file->basename[0]) {
flist->files[flist->count++] = file;
send_file_entry(file, f, base_flags);
if (file->basename[0]) {
flist->files[flist->count++] = file;
send_file_entry(file, f, base_flags);
@@
-1039,6
+1035,8
@@
static void send_directory(int f, struct file_list *flist, char *dir)
/**
/**
+ * This function is normally called by the sender, but the receiver also
+ * uses it to construct its own file list if --delete has been specified.
* The delete_files() function in receiver.c sets f to -1 so that we just
* construct the file list in memory without sending it over the wire. It
* also has the side-effect of ignoring user-excludes if delete_excluded
* The delete_files() function in receiver.c sets f to -1 so that we just
* construct the file list in memory without sending it over the wire. It
* also has the side-effect of ignoring user-excludes if delete_excluded
@@
-1063,7
+1061,7
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
"send_file_list");
if (f != -1) {
"send_file_list");
if (f != -1) {
- io_start_buffering_out(
f
);
+ io_start_buffering_out();
if (filesfrom_fd >= 0) {
if (argv[0] && !push_dir(argv[0])) {
rsyserr(FERROR, errno, "push_dir %s failed",
if (filesfrom_fd >= 0) {
if (argv[0] && !push_dir(argv[0])) {
rsyserr(FERROR, errno, "push_dir %s failed",
@@
-1081,13
+1079,13
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
if (use_ff_fd) {
if (read_filesfrom_line(filesfrom_fd, fname) == 0)
break;
if (use_ff_fd) {
if (read_filesfrom_line(filesfrom_fd, fname) == 0)
break;
- sanitize_path(fname,
NULL
);
+ sanitize_path(fname,
fname, "", 0
);
} else {
if (argc-- == 0)
break;
strlcpy(fname, *argv++, MAXPATHLEN);
if (sanitize_paths)
} else {
if (argc-- == 0)
break;
strlcpy(fname, *argv++, MAXPATHLEN);
if (sanitize_paths)
- sanitize_path(fname,
NULL
);
+ sanitize_path(fname,
fname, "", 0
);
}
l = strlen(fname);
}
l = strlen(fname);
@@
-1229,8
+1227,6
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
io_end_buffering();
stats.flist_size = stats.total_written - start_write;
stats.num_files = flist->count;
io_end_buffering();
stats.flist_size = stats.total_written - start_write;
stats.num_files = flist->count;
- if (write_batch)
- write_batch_flist_info(flist->count, flist->files);
}
if (verbose > 3)
}
if (verbose > 3)
@@
-1299,13
+1295,11
@@
struct file_list *recv_file_list(int f)
* protocol version 15 */
recv_uid_list(f, flist);
* protocol version 15 */
recv_uid_list(f, flist);
- if (!read_batch) {
- /* Recv the io_error flag */
- if (lp_ignore_errors(module_id) || ignore_errors)
- read_int(f);
- else
- io_error |= read_int(f);
- }
+ /* Recv the io_error flag */
+ if (lp_ignore_errors(module_id) || ignore_errors)
+ read_int(f);
+ else
+ io_error |= read_int(f);
}
if (verbose > 3)
}
if (verbose > 3)