summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2003-12-15 08:10:31 +0000
committerWayne Davison <wayned@samba.org>2003-12-15 08:10:31 +0000
commit06c28400fa4ce46406d4a0bbf417b9b07df0a29a (patch)
treeaf336126f221a4e1efe159232a36ca473479791b
parent6e35c72fdbe4951412081f34b2bcd1ca10ee7225 (diff)
downloadrsync-06c28400fa4ce46406d4a0bbf417b9b07df0a29a.tar.gz
rsync-06c28400fa4ce46406d4a0bbf417b9b07df0a29a.tar.bz2
rsync-06c28400fa4ce46406d4a0bbf417b9b07df0a29a.zip
New "io_error" variable handling for RERR_VANISHED support.
-rw-r--r--flist.c17
-rw-r--r--options.c1
-rw-r--r--sender.c24
3 files changed, 23 insertions, 19 deletions
diff --git a/flist.c b/flist.c
index 6cdc050d..d50a9470 100644
--- a/flist.c
+++ b/flist.c
@@ -58,7 +58,6 @@ extern int implied_dirs;
extern int copy_links;
extern int copy_unsafe_links;
extern int protocol_version;
-extern int io_error;
extern int sanitize_paths;
extern int read_batch;
@@ -68,6 +67,8 @@ extern struct exclude_struct **exclude_list;
extern struct exclude_struct **server_exclude_list;
extern struct exclude_struct **local_exclude_list;
+int io_error;
+
static struct file_struct null_file;
static void clean_flist(struct file_list *flist, int strip_root, int no_dups);
@@ -694,7 +695,7 @@ struct file_struct *make_file(char *fname, struct string_area **ap,
return NULL;
}
}
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "readlink %s failed: %s\n",
full_fname(fname), strerror(save_errno));
return NULL;
@@ -844,7 +845,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
d = opendir(dir);
if (!d) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "opendir %s failed: %s\n",
full_fname(dir), strerror(errno));
return;
@@ -854,7 +855,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
l = strlen(fname);
if (fname[l - 1] != '/') {
if (l == MAXPATHLEN - 1) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "skipping long-named directory: %s\n",
full_fname(fname));
closedir(d);
@@ -872,7 +873,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
strcpy(p, ".cvsignore");
add_exclude_file(&exclude_list,fname,MISSING_OK,ADD_EXCLUDE);
} else {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FINFO,
"cannot cvs-exclude in long-named directory %s\n",
full_fname(fname));
@@ -888,7 +889,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
send_file_name(f, flist, fname, recurse, 0);
}
if (errno) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "readdir(%s): (%d) %s\n",
dir, errno, strerror(errno));
}
@@ -963,7 +964,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
if (link_stat(fname, &st) != 0) {
if (f != -1) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "link_stat %s failed: %s\n",
full_fname(fname), strerror(errno));
}
@@ -1030,7 +1031,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
olddir = push_dir(dir, 1);
if (!olddir) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "push_dir %s failed: %s\n",
full_fname(dir), strerror(errno));
continue;
diff --git a/options.c b/options.c
index 85880caf..8a1a9abf 100644
--- a/options.c
+++ b/options.c
@@ -62,7 +62,6 @@ int implied_dirs = 1;
int numeric_ids = 0;
int force_delete = 0;
int io_timeout = 0;
-int io_error = 0;
int read_only = 0;
int module_id = -1;
int am_server = 0;
diff --git a/sender.c b/sender.c
index 7d7b5862..315809e5 100644
--- a/sender.c
+++ b/sender.c
@@ -162,7 +162,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
if (file->basedir) {
strlcpy(fname, file->basedir, MAXPATHLEN);
if (strlen(fname) == MAXPATHLEN-1) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "send_files failed on long-named directory %s\n",
full_fname(fname));
return;
@@ -187,7 +187,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
s = receive_sums(f_in);
if (!s) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "receive_sums failed\n");
return;
}
@@ -198,16 +198,22 @@ void send_files(struct file_list *flist, int f_out, int f_in)
if (!read_batch) {
fd = do_open(fname, O_RDONLY, 0);
if (fd == -1) {
- io_error = 1;
- rprintf(FERROR, "send_files failed to open %s: %s\n",
- full_fname(fname), strerror(errno));
+ if (errno == ENOENT) {
+ io_error |= IOERR_VANISHED;
+ rprintf(FINFO, "file has vanished: %s\n",
+ full_fname(fname));
+ } else {
+ io_error |= IOERR_GENERAL;
+ rprintf(FERROR, "send_files failed to open %s: %s\n",
+ full_fname(fname), strerror(errno));
+ }
free_sums(s);
continue;
}
/* map the local file */
if (do_fstat(fd, &st) != 0) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "fstat failed: %s\n", strerror(errno));
free_sums(s);
close(fd);
@@ -286,12 +292,10 @@ void send_files(struct file_list *flist, int f_out, int f_in)
if (buf) {
j = unmap_file(buf);
if (j) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR,
"read errors mapping %s: (%d) %s\n",
- full_fname(fname),
- j,
- strerror(j));
+ full_fname(fname), j, strerror(j));
}
}
close(fd);