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 the use of --xattrs with --only-write-batch.
[rsync/rsync.git]
/
sender.c
diff --git
a/sender.c
b/sender.c
index
b2ca39c
..
e0b440d
100644
(file)
--- a/
sender.c
+++ b/
sender.c
@@
-3,11
+3,12
@@
*
* Copyright (C) 1996 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
*
* Copyright (C) 1996 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
- * Copyright (C) 2003-200
7
Wayne Davison
+ * Copyright (C) 2003-200
9
Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-15,14
+16,12
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ * with this program; if not, visit the http://fsf.org website.
*/
#include "rsync.h"
extern int verbose;
*/
#include "rsync.h"
extern int verbose;
-extern int dry_run;
extern int do_xfers;
extern int am_server;
extern int am_daemon;
extern int do_xfers;
extern int am_server;
extern int am_daemon;
@@
-44,7
+43,7
@@
extern int inplace;
extern int batch_fd;
extern int write_batch;
extern struct stats stats;
extern int batch_fd;
extern int write_batch;
extern struct stats stats;
-extern struct file_list *cur_flist, *first_flist;
+extern struct file_list *cur_flist, *first_flist
, *dir_flist
;
/**
* @file
/**
* @file
@@
-127,15
+126,9
@@
void successful_send(int ndx)
if (!remove_source_files)
return;
if (!remove_source_files)
return;
- if (!(flist = flist_for_ndx(ndx))) {
- rprintf(FERROR,
- "INTERNAL ERROR: unable to find flist for item %d\n",
- ndx);
- return;
- }
-
+ flist = flist_for_ndx(ndx, "successful_send");
file = flist->files[ndx - flist->ndx_start];
file = flist->files[ndx - flist->ndx_start];
- if (!
push_pathname(F_PATHNAME(file), -1
))
+ if (!
change_pathname(file, NULL, 0
))
return;
f_name(file, fname);
return;
f_name(file, fname);
@@
-159,7
+152,7
@@
static void write_ndx_and_attrs(int f_out, int ndx, int iflags,
if (iflags & ITEM_XNAME_FOLLOWS)
write_vstring(f_out, buf, len);
#ifdef SUPPORT_XATTRS
if (iflags & ITEM_XNAME_FOLLOWS)
write_vstring(f_out, buf, len);
#ifdef SUPPORT_XATTRS
- if (preserve_xattrs && iflags & ITEM_REPORT_XATTR &&
!dry_run
)
+ if (preserve_xattrs && iflags & ITEM_REPORT_XATTR &&
do_xfers
)
send_xattr_request(fname, file, f_out);
#endif
}
send_xattr_request(fname, file, f_out);
#endif
}
@@
-211,14
+204,17
@@
void send_files(int f_in, int f_out)
if (inc_recurse)
send_extra_file_list(f_out, FILECNT_LOOKAHEAD);
if (inc_recurse)
send_extra_file_list(f_out, FILECNT_LOOKAHEAD);
- file = cur_flist->files[ndx - cur_flist->ndx_start];
+ if (ndx - cur_flist->ndx_start >= 0)
+ file = cur_flist->files[ndx - cur_flist->ndx_start];
+ else
+ file = dir_flist->files[cur_flist->parent_ndx];
if (F_PATHNAME(file)) {
path = F_PATHNAME(file);
slash = "/";
} else {
path = slash = "";
}
if (F_PATHNAME(file)) {
path = F_PATHNAME(file);
slash = "/";
} else {
path = slash = "";
}
- if (!
push_pathname(F_PATHNAME(file), -1
))
+ if (!
change_pathname(file, NULL, 0
))
continue;
f_name(file, fname);
continue;
f_name(file, fname);
@@
-226,7
+222,7
@@
void send_files(int f_in, int f_out)
rprintf(FINFO, "send_files(%d, %s%s%s)\n", ndx, path,slash,fname);
#ifdef SUPPORT_XATTRS
rprintf(FINFO, "send_files(%d, %s%s%s)\n", ndx, path,slash,fname);
#ifdef SUPPORT_XATTRS
- if (preserve_xattrs && iflags & ITEM_REPORT_XATTR)
+ if (preserve_xattrs && iflags & ITEM_REPORT_XATTR
&& do_xfers
)
recv_xattr_request(file, f_in);
#endif
recv_xattr_request(file, f_in);
#endif
@@
-262,7
+258,8
@@
void send_files(int f_in, int f_out)
updating_basis_file = inplace && (protocol_version >= 29
? fnamecmp_type == FNAMECMP_FNAME : make_backups <= 0);
updating_basis_file = inplace && (protocol_version >= 29
? fnamecmp_type == FNAMECMP_FNAME : make_backups <= 0);
- stats.current_file_index = ndx;
+ if (!am_server && do_progress)
+ set_current_file_index(file, ndx);
stats.num_transferred_files++;
stats.total_transferred_size += F_LENGTH(file);
stats.num_transferred_files++;
stats.total_transferred_size += F_LENGTH(file);
@@
-277,7
+274,7
@@
void send_files(int f_in, int f_out)
if (!(s = receive_sums(f_in))) {
io_error |= IOERR_GENERAL;
if (!(s = receive_sums(f_in))) {
io_error |= IOERR_GENERAL;
- rprintf(FERROR, "receive_sums failed\n");
+ rprintf(FERROR
_XFER
, "receive_sums failed\n");
exit_cleanup(RERR_PROTOCOL);
}
exit_cleanup(RERR_PROTOCOL);
}
@@
-286,13
+283,13
@@
void send_files(int f_in, int f_out)
if (errno == ENOENT) {
enum logcode c = am_daemon
&& protocol_version < 28 ? FERROR
if (errno == ENOENT) {
enum logcode c = am_daemon
&& protocol_version < 28 ? FERROR
- : F
INFO
;
+ : F
WARNING
;
io_error |= IOERR_VANISHED;
rprintf(c, "file has vanished: %s\n",
full_fname(fname));
} else {
io_error |= IOERR_GENERAL;
io_error |= IOERR_VANISHED;
rprintf(c, "file has vanished: %s\n",
full_fname(fname));
} else {
io_error |= IOERR_GENERAL;
- rsyserr(FERROR, errno,
+ rsyserr(FERROR
_XFER
, errno,
"send_files failed to open %s",
full_fname(fname));
}
"send_files failed to open %s",
full_fname(fname));
}
@@
-305,7
+302,7
@@
void send_files(int f_in, int f_out)
/* map the local file */
if (do_fstat(fd, &st) != 0) {
io_error |= IOERR_GENERAL;
/* map the local file */
if (do_fstat(fd, &st) != 0) {
io_error |= IOERR_GENERAL;
- rsyserr(FERROR, errno, "fstat failed");
+ rsyserr(FERROR
_XFER
, errno, "fstat failed");
free_sums(s);
close(fd);
exit_cleanup(RERR_PROTOCOL);
free_sums(s);
close(fd);
exit_cleanup(RERR_PROTOCOL);
@@
-346,7
+343,7
@@
void send_files(int f_in, int f_out)
j = unmap_file(mbuf);
if (j) {
io_error |= IOERR_GENERAL;
j = unmap_file(mbuf);
if (j) {
io_error |= IOERR_GENERAL;
- rsyserr(FERROR, j,
+ rsyserr(FERROR
_XFER
, j,
"read errors mapping %s",
full_fname(fname));
}
"read errors mapping %s",
full_fname(fname));
}