Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
49c2407
)
Handle a link_stat() failure with errno ENOENT as a vanished file.
author
Wayne Davison
<wayned@samba.org>
Sat, 14 Feb 2009 16:35:57 +0000
(08:35 -0800)
committer
Wayne Davison
<wayned@samba.org>
Sat, 14 Feb 2009 16:35:57 +0000
(08:35 -0800)
flist.c
patch
|
blob
|
blame
|
history
diff --git
a/flist.c
b/flist.c
index
0fc7851
..
2fdff34
100644
(file)
--- a/
flist.c
+++ b/
flist.c
@@
-1627,6
+1627,19
@@
static void add_dirs_to_tree(int parent_ndx, struct file_list *from_flist,
DIR_NEXT_SIBLING(dp) = -1;
}
DIR_NEXT_SIBLING(dp) = -1;
}
+static void interpret_stat_error(const char *fname, int is_dir)
+{
+ if (errno == ENOENT) {
+ io_error |= IOERR_VANISHED;
+ rprintf(FWARNING, "%s has vanished: %s\n",
+ is_dir ? "directory" : "file", full_fname(fname));
+ } else {
+ io_error |= IOERR_GENERAL;
+ rsyserr(FERROR_XFER, errno, "link_stat %s failed",
+ full_fname(fname));
+ }
+}
+
/* This function is normally called by the sender, but the receiving side also
* calls it from get_dirlist() with f set to -1 so that we just construct the
* file list in memory without sending it over the wire. Also, get_dirlist()
/* This function is normally called by the sender, but the receiving side also
* calls it from get_dirlist() with f set to -1 so that we just construct the
* file list in memory without sending it over the wire. Also, get_dirlist()
@@
-1646,8
+1659,11
@@
static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
assert(flist != NULL);
if (!(d = opendir(fbuf))) {
assert(flist != NULL);
if (!(d = opendir(fbuf))) {
- if (errno == ENOENT)
+ if (errno == ENOENT) {
+ if (am_sender) /* Can abuse this for vanished error w/ENOENT: */
+ interpret_stat_error(fbuf, True);
return;
return;
+ }
io_error |= IOERR_GENERAL;
rsyserr(FERROR_XFER, errno, "opendir %s failed", full_fname(fbuf));
return;
io_error |= IOERR_GENERAL;
rsyserr(FERROR_XFER, errno, "opendir %s failed", full_fname(fbuf));
return;
@@
-1819,9
+1835,7
@@
static void send1extra(int f, struct file_struct *file, struct file_list *flist)
if (one_file_system) {
STRUCT_STAT st;
if (link_stat(fbuf, &st, copy_dirlinks) != 0) {
if (one_file_system) {
STRUCT_STAT st;
if (link_stat(fbuf, &st, copy_dirlinks) != 0) {
- io_error |= IOERR_GENERAL;
- rsyserr(FERROR_XFER, errno, "link_stat %s failed",
- full_fname(fbuf));
+ interpret_stat_error(fbuf, True);
return;
}
filesystem_dev = st.st_dev;
return;
}
filesystem_dev = st.st_dev;
@@
-1856,9
+1870,7
@@
static void send1extra(int f, struct file_struct *file, struct file_list *flist)
if (name_type != NORMAL_NAME) {
STRUCT_STAT st;
if (link_stat(fbuf, &st, 1) != 0) {
if (name_type != NORMAL_NAME) {
STRUCT_STAT st;
if (link_stat(fbuf, &st, 1) != 0) {
- io_error |= IOERR_GENERAL;
- rsyserr(FERROR_XFER, errno, "link_stat %s failed",
- full_fname(fbuf));
+ interpret_stat_error(fbuf, True);
continue;
}
send_file_name(f, flist, fbuf, &st, FLAG_TOP_DIR | flags, ALL_FILTERS);
continue;
}
send_file_name(f, flist, fbuf, &st, FLAG_TOP_DIR | flags, ALL_FILTERS);