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
Fixed a problem with checking for the '.' dir in the first file
[rsync/rsync.git]
/
flist.c
diff --git
a/flist.c
b/flist.c
index
b3a2653
..
c189824
100644
(file)
--- a/
flist.c
+++ b/
flist.c
@@
-66,6
+66,7
@@
extern int sanitize_paths;
extern int munge_symlinks;
extern int need_unsorted_flist;
extern int output_needs_newline;
extern int munge_symlinks;
extern int need_unsorted_flist;
extern int output_needs_newline;
+extern int sender_keeps_checksum;
extern int unsort_ndx;
extern struct stats stats;
extern char *filesfrom_host;
extern int unsort_ndx;
extern struct stats stats;
extern char *filesfrom_host;
@@
-375,7
+376,7
@@
int change_pathname(struct file_struct *file, const char *dir, int dirlen)
if (!change_dir(dir, CD_NORMAL)) {
chdir_error:
io_error |= IOERR_GENERAL;
if (!change_dir(dir, CD_NORMAL)) {
chdir_error:
io_error |= IOERR_GENERAL;
- rsyserr(FERROR, errno, "change_dir %s failed", full_fname(dir));
+ rsyserr(FERROR
_XFER
, errno, "change_dir %s failed", full_fname(dir));
if (dir != orig_dir)
change_dir(orig_dir, CD_NORMAL);
pathname = NULL;
if (dir != orig_dir)
change_dir(orig_dir, CD_NORMAL);
pathname = NULL;
@@
-688,11
+689,11
@@
static struct file_struct *recv_file_entry(struct file_list *flist,
xbuf outbuf, inbuf;
INIT_CONST_XBUF(outbuf, thisname);
xbuf outbuf, inbuf;
INIT_CONST_XBUF(outbuf, thisname);
- INIT_XBUF(inbuf, lastname, basename_len, -1);
+ INIT_XBUF(inbuf, lastname, basename_len,
(size_t)
-1);
if (iconvbufs(ic_recv, &inbuf, &outbuf, 0) < 0) {
io_error |= IOERR_GENERAL;
if (iconvbufs(ic_recv, &inbuf, &outbuf, 0) < 0) {
io_error |= IOERR_GENERAL;
- rprintf(F
INFO
,
+ rprintf(F
ERROR_XFER
,
"[%s] cannot convert filename: %s (%s)\n",
who_am_i(), lastname, strerror(errno));
outbuf.len = 0;
"[%s] cannot convert filename: %s (%s)\n",
who_am_i(), lastname, strerror(errno));
outbuf.len = 0;
@@
-1067,7
+1068,7
@@
struct file_struct *make_file(const char *fname, struct file_list *flist,
if (strlcpy(thisname, fname, sizeof thisname) >= sizeof thisname) {
io_error |= IOERR_GENERAL;
if (strlcpy(thisname, fname, sizeof thisname) >= sizeof thisname) {
io_error |= IOERR_GENERAL;
- rprintf(F
INFO
, "skipping overly long name: %s\n", fname);
+ rprintf(F
ERROR_XFER
, "skipping overly long name: %s\n", fname);
return NULL;
}
clean_fname(thisname, 0);
return NULL;
}
clean_fname(thisname, 0);
@@
-1209,6
+1210,12
@@
struct file_struct *make_file(const char *fname, struct file_list *flist,
extra_len += EXTRA_LEN;
#endif
extra_len += EXTRA_LEN;
#endif
+ if (always_checksum && am_sender && S_ISREG(st.st_mode)) {
+ file_checksum(thisname, tmp_sum, st.st_size);
+ if (sender_keeps_checksum)
+ extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
+ }
+
#if EXTRA_ROUNDING > 0
if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN))
extra_len = (extra_len | (EXTRA_ROUNDING * EXTRA_LEN)) + EXTRA_LEN;
#if EXTRA_ROUNDING > 0
if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN))
extra_len = (extra_len | (EXTRA_ROUNDING * EXTRA_LEN)) + EXTRA_LEN;
@@
-1235,8
+1242,8
@@
struct file_struct *make_file(const char *fname, struct file_list *flist,
if (protocol_version >= 28
? (!S_ISDIR(st.st_mode) && st.st_nlink > 1)
: S_ISREG(st.st_mode)) {
if (protocol_version >= 28
? (!S_ISDIR(st.st_mode) && st.st_nlink > 1)
: S_ISREG(st.st_mode)) {
- tmp_dev =
st.st_dev
;
- tmp_ino = st.st_ino;
+ tmp_dev =
(int64)st.st_dev + 1
;
+ tmp_ino =
(int64)
st.st_ino;
} else
tmp_dev = 0;
}
} else
tmp_dev = 0;
}
@@
-1272,9
+1279,6
@@
struct file_struct *make_file(const char *fname, struct file_list *flist,
memcpy(bp + basename_len, linkname, linkname_len);
#endif
memcpy(bp + basename_len, linkname, linkname_len);
#endif
- if (always_checksum && am_sender && S_ISREG(st.st_mode))
- file_checksum(thisname, tmp_sum, st.st_size);
-
if (am_sender)
F_PATHNAME(file) = pathname;
else if (!pool)
if (am_sender)
F_PATHNAME(file) = pathname;
else if (!pool)
@@
-1305,6
+1309,9
@@
struct file_struct *make_file(const char *fname, struct file_list *flist,
return NULL;
}
return NULL;
}
+ if (sender_keeps_checksum && S_ISREG(st.st_mode))
+ memcpy(F_SUM(file), tmp_sum, checksum_len);
+
if (unsort_ndx)
F_NDX(file) = dir_count;
if (unsort_ndx)
F_NDX(file) = dir_count;
@@
-1355,7
+1362,7
@@
static struct file_struct *send_file_name(int f, struct file_list *flist,
if (iconvbufs(ic_send, &inbuf, &outbuf, 0) < 0) {
convert_error:
io_error |= IOERR_GENERAL;
if (iconvbufs(ic_send, &inbuf, &outbuf, 0) < 0) {
convert_error:
io_error |= IOERR_GENERAL;
- rprintf(F
INFO
,
+ rprintf(F
ERROR_XFER
,
"[%s] cannot convert filename: %s (%s)\n",
who_am_i(), f_name(file, fbuf), strerror(errno));
return NULL;
"[%s] cannot convert filename: %s (%s)\n",
who_am_i(), f_name(file, fbuf), strerror(errno));
return NULL;
@@
-1580,14
+1587,14
@@
static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
continue;
if (strlcpy(p, dname, remainder) >= remainder) {
io_error |= IOERR_GENERAL;
continue;
if (strlcpy(p, dname, remainder) >= remainder) {
io_error |= IOERR_GENERAL;
- rprintf(F
INFO
,
+ rprintf(F
ERROR_XFER
,
"cannot send long-named file %s\n",
full_fname(fbuf));
continue;
}
if (dname[0] == '\0') {
io_error |= IOERR_GENERAL;
"cannot send long-named file %s\n",
full_fname(fbuf));
continue;
}
if (dname[0] == '\0') {
io_error |= IOERR_GENERAL;
- rprintf(F
INFO
,
+ rprintf(F
ERROR_XFER
,
"cannot send file with empty name in %s\n",
full_fname(fbuf));
continue;
"cannot send file with empty name in %s\n",
full_fname(fbuf));
continue;
@@
-2186,7
+2193,7
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
if (inc_recurse) {
send_dir_depth = 1;
add_dirs_to_tree(-1, flist, dir_count);
if (inc_recurse) {
send_dir_depth = 1;
add_dirs_to_tree(-1, flist, dir_count);
- if (!file_total || strcmp(flist->sorted[
0
]->basename, ".") != 0)
+ if (!file_total || strcmp(flist->sorted[
flist->low
]->basename, ".") != 0)
flist->parent_ndx = -1;
flist_done_allocating(flist);
if (send_dir_ndx < 0) {
flist->parent_ndx = -1;
flist_done_allocating(flist);
if (send_dir_ndx < 0) {
@@
-2210,12
+2217,13
@@
struct file_list *recv_file_list(int f)
int dstart, flags;
int64 start_read;
int dstart, flags;
int64 start_read;
- if (!first_flist)
+ if (!first_flist) {
+ if (show_filelist_p())
+ start_filelist_progress("receiving file list");
+ else if (inc_recurse && INFO_GTE(FLIST, 1) && !am_server)
+ rprintf(FCLIENT, "receiving incremental file list\n");
rprintf(FLOG, "receiving file list\n");
rprintf(FLOG, "receiving file list\n");
- if (show_filelist_p())
- start_filelist_progress("receiving file list");
- else if (inc_recurse && INFO_GTE(FLIST, 1) && !am_server && !first_flist)
- rprintf(FCLIENT, "receiving incremental file list\n");
+ }
start_read = stats.total_read;
start_read = stats.total_read;
@@
-2310,7
+2318,7
@@
struct file_list *recv_file_list(int f)
else
io_error |= read_int(f);
} else if (inc_recurse && flist->ndx_start == 1) {
else
io_error |= read_int(f);
} else if (inc_recurse && flist->ndx_start == 1) {
- if (!file_total || strcmp(flist->sorted[
0
]->basename, ".") != 0)
+ if (!file_total || strcmp(flist->sorted[
flist->low
]->basename, ".") != 0)
flist->parent_ndx = -1;
}
flist->parent_ndx = -1;
}
@@
-2430,14
+2438,16
@@
struct file_list *flist_new(int flags, char *msg)
if (flags & FLIST_TEMP) {
if (!(flist->file_pool = pool_create(SMALL_EXTENT, 0,
if (flags & FLIST_TEMP) {
if (!(flist->file_pool = pool_create(SMALL_EXTENT, 0,
- out_of_memory, POOL_INTERN)))
+ out_of_memory,
+ POOL_INTERN)))
out_of_memory(msg);
} else {
/* This is a doubly linked list with prev looping back to
* the end of the list, but the last next pointer is NULL. */
if (!first_flist) {
flist->file_pool = pool_create(NORMAL_EXTENT, 0,
out_of_memory(msg);
} else {
/* This is a doubly linked list with prev looping back to
* the end of the list, but the last next pointer is NULL. */
if (!first_flist) {
flist->file_pool = pool_create(NORMAL_EXTENT, 0,
- out_of_memory, POOL_INTERN);
+ out_of_memory,
+ POOL_INTERN);
if (!flist->file_pool)
out_of_memory(msg);
if (!flist->file_pool)
out_of_memory(msg);