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;
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);
return NULL;
}
}
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "readlink %s failed: %s\n",
full_fname(fname), strerror(save_errno));
return NULL;
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;
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);
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));
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));
}
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));
}
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;
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;
s = receive_sums(f_in);
if (!s) {
- io_error = 1;
+ io_error |= IOERR_GENERAL;
rprintf(FERROR, "receive_sums failed\n");
return;
}
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);
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);