Commit 06c28400 authored by Wayne Davison's avatar Wayne Davison

New "io_error" variable handling for RERR_VANISHED support.

parent 6e35c72f
...@@ -58,7 +58,6 @@ extern int implied_dirs; ...@@ -58,7 +58,6 @@ extern int implied_dirs;
extern int copy_links; extern int copy_links;
extern int copy_unsafe_links; extern int copy_unsafe_links;
extern int protocol_version; extern int protocol_version;
extern int io_error;
extern int sanitize_paths; extern int sanitize_paths;
extern int read_batch; extern int read_batch;
...@@ -68,6 +67,8 @@ extern struct exclude_struct **exclude_list; ...@@ -68,6 +67,8 @@ extern struct exclude_struct **exclude_list;
extern struct exclude_struct **server_exclude_list; extern struct exclude_struct **server_exclude_list;
extern struct exclude_struct **local_exclude_list; extern struct exclude_struct **local_exclude_list;
int io_error;
static struct file_struct null_file; static struct file_struct null_file;
static void clean_flist(struct file_list *flist, int strip_root, int no_dups); 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, ...@@ -694,7 +695,7 @@ struct file_struct *make_file(char *fname, struct string_area **ap,
return NULL; return NULL;
} }
} }
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, "readlink %s failed: %s\n", rprintf(FERROR, "readlink %s failed: %s\n",
full_fname(fname), strerror(save_errno)); full_fname(fname), strerror(save_errno));
return NULL; return NULL;
...@@ -844,7 +845,7 @@ static void send_directory(int f, struct file_list *flist, char *dir) ...@@ -844,7 +845,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
d = opendir(dir); d = opendir(dir);
if (!d) { if (!d) {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, "opendir %s failed: %s\n", rprintf(FERROR, "opendir %s failed: %s\n",
full_fname(dir), strerror(errno)); full_fname(dir), strerror(errno));
return; return;
...@@ -854,7 +855,7 @@ static void send_directory(int f, struct file_list *flist, char *dir) ...@@ -854,7 +855,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
l = strlen(fname); l = strlen(fname);
if (fname[l - 1] != '/') { if (fname[l - 1] != '/') {
if (l == MAXPATHLEN - 1) { if (l == MAXPATHLEN - 1) {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, "skipping long-named directory: %s\n", rprintf(FERROR, "skipping long-named directory: %s\n",
full_fname(fname)); full_fname(fname));
closedir(d); closedir(d);
...@@ -872,7 +873,7 @@ static void send_directory(int f, struct file_list *flist, char *dir) ...@@ -872,7 +873,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
strcpy(p, ".cvsignore"); strcpy(p, ".cvsignore");
add_exclude_file(&exclude_list,fname,MISSING_OK,ADD_EXCLUDE); add_exclude_file(&exclude_list,fname,MISSING_OK,ADD_EXCLUDE);
} else { } else {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FINFO, rprintf(FINFO,
"cannot cvs-exclude in long-named directory %s\n", "cannot cvs-exclude in long-named directory %s\n",
full_fname(fname)); full_fname(fname));
...@@ -888,7 +889,7 @@ static void send_directory(int f, struct file_list *flist, char *dir) ...@@ -888,7 +889,7 @@ static void send_directory(int f, struct file_list *flist, char *dir)
send_file_name(f, flist, fname, recurse, 0); send_file_name(f, flist, fname, recurse, 0);
} }
if (errno) { if (errno) {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, "readdir(%s): (%d) %s\n", rprintf(FERROR, "readdir(%s): (%d) %s\n",
dir, errno, strerror(errno)); dir, errno, strerror(errno));
} }
...@@ -963,7 +964,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) ...@@ -963,7 +964,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
if (link_stat(fname, &st) != 0) { if (link_stat(fname, &st) != 0) {
if (f != -1) { if (f != -1) {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, "link_stat %s failed: %s\n", rprintf(FERROR, "link_stat %s failed: %s\n",
full_fname(fname), strerror(errno)); full_fname(fname), strerror(errno));
} }
...@@ -1030,7 +1031,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) ...@@ -1030,7 +1031,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
olddir = push_dir(dir, 1); olddir = push_dir(dir, 1);
if (!olddir) { if (!olddir) {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, "push_dir %s failed: %s\n", rprintf(FERROR, "push_dir %s failed: %s\n",
full_fname(dir), strerror(errno)); full_fname(dir), strerror(errno));
continue; continue;
......
...@@ -62,7 +62,6 @@ int implied_dirs = 1; ...@@ -62,7 +62,6 @@ int implied_dirs = 1;
int numeric_ids = 0; int numeric_ids = 0;
int force_delete = 0; int force_delete = 0;
int io_timeout = 0; int io_timeout = 0;
int io_error = 0;
int read_only = 0; int read_only = 0;
int module_id = -1; int module_id = -1;
int am_server = 0; int am_server = 0;
......
...@@ -162,7 +162,7 @@ void send_files(struct file_list *flist, int f_out, int f_in) ...@@ -162,7 +162,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
if (file->basedir) { if (file->basedir) {
strlcpy(fname, file->basedir, MAXPATHLEN); strlcpy(fname, file->basedir, MAXPATHLEN);
if (strlen(fname) == MAXPATHLEN-1) { if (strlen(fname) == MAXPATHLEN-1) {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, "send_files failed on long-named directory %s\n", rprintf(FERROR, "send_files failed on long-named directory %s\n",
full_fname(fname)); full_fname(fname));
return; return;
...@@ -187,7 +187,7 @@ void send_files(struct file_list *flist, int f_out, int f_in) ...@@ -187,7 +187,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
s = receive_sums(f_in); s = receive_sums(f_in);
if (!s) { if (!s) {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, "receive_sums failed\n"); rprintf(FERROR, "receive_sums failed\n");
return; return;
} }
...@@ -198,16 +198,22 @@ void send_files(struct file_list *flist, int f_out, int f_in) ...@@ -198,16 +198,22 @@ void send_files(struct file_list *flist, int f_out, int f_in)
if (!read_batch) { if (!read_batch) {
fd = do_open(fname, O_RDONLY, 0); fd = do_open(fname, O_RDONLY, 0);
if (fd == -1) { if (fd == -1) {
io_error = 1; if (errno == ENOENT) {
rprintf(FERROR, "send_files failed to open %s: %s\n", io_error |= IOERR_VANISHED;
full_fname(fname), strerror(errno)); 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); free_sums(s);
continue; continue;
} }
/* map the local file */ /* map the local file */
if (do_fstat(fd, &st) != 0) { if (do_fstat(fd, &st) != 0) {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, "fstat failed: %s\n", strerror(errno)); rprintf(FERROR, "fstat failed: %s\n", strerror(errno));
free_sums(s); free_sums(s);
close(fd); close(fd);
...@@ -286,12 +292,10 @@ void send_files(struct file_list *flist, int f_out, int f_in) ...@@ -286,12 +292,10 @@ void send_files(struct file_list *flist, int f_out, int f_in)
if (buf) { if (buf) {
j = unmap_file(buf); j = unmap_file(buf);
if (j) { if (j) {
io_error = 1; io_error |= IOERR_GENERAL;
rprintf(FERROR, rprintf(FERROR,
"read errors mapping %s: (%d) %s\n", "read errors mapping %s: (%d) %s\n",
full_fname(fname), full_fname(fname), j, strerror(j));
j,
strerror(j));
} }
} }
close(fd); close(fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment