extern int preserve_devices;
extern int preserve_uid;
extern int preserve_gid;
-extern int preserve_times;
extern int relative_paths;
extern int implied_dirs;
extern int copy_links;
*/
static int check_exclude_file(char *fname, int is_dir, int exclude_level)
{
+ int rc;
+
#if 0 /* This currently never happens, so avoid a useless compare. */
if (exclude_level == NO_EXCLUDES)
return 0;
}
}
if (server_exclude_list.head
- && check_exclude(&server_exclude_list, fname, is_dir,
- "server pattern"))
+ && check_exclude(&server_exclude_list, fname, is_dir) < 0)
return 1;
if (exclude_level != ALL_EXCLUDES)
return 0;
if (exclude_list.head
- && check_exclude(&exclude_list, fname, is_dir, "pattern"))
- return 1;
+ && (rc = check_exclude(&exclude_list, fname, is_dir)) != 0)
+ return rc < 0;
if (local_exclude_list.head
- && check_exclude(&local_exclude_list, fname, is_dir,
- "local-cvsignore"))
+ && check_exclude(&local_exclude_list, fname, is_dir) < 0)
return 1;
return 0;
}
rdev_major = 0;
uid = 0, gid = 0;
*lastname = '\0';
+ lastdir_len = -1;
return;
}
char *basename, *dirname, *bp;
unsigned short flags = 0;
- if (!flist) /* lastdir isn't valid if flist is NULL */
+ if (!flist || !flist->count) /* Ignore lastdir when invalid. */
lastdir_len = -1;
if (strlcpy(thisname, fname, sizeof thisname)
}
else {
io_error |= IOERR_GENERAL;
- rprintf(FERROR, "readlink %s failed: %s\n",
- full_fname(thisname), strerror(save_errno));
+ rsyserr(FERROR, save_errno, "readlink %s failed",
+ full_fname(thisname));
}
return NULL;
}
if (recursive && S_ISDIR(file->mode)
&& !(file->flags & FLAG_MOUNT_POINT)) {
struct exclude_list_struct last_list = local_exclude_list;
- memset(&local_exclude_list, 0, sizeof local_exclude_list);
+ local_exclude_list.head = local_exclude_list.tail = NULL;
send_directory(f, flist, f_name_to(file, fbuf));
+ if (verbose > 2) {
+ rprintf(FINFO, "[%s] popping %sexclude list\n",
+ who_am_i(), local_exclude_list.debug_type);
+ }
free_exclude_list(&local_exclude_list);
local_exclude_list = last_list;
}
d = opendir(dir);
if (!d) {
io_error |= IOERR_GENERAL;
- rprintf(FERROR, "opendir %s failed: %s\n",
- full_fname(dir), strerror(errno));
+ rsyserr(FERROR, errno, "opendir %s failed", full_fname(dir));
return;
}
if (strlcpy(p, ".cvsignore", MAXPATHLEN - offset)
< MAXPATHLEN - offset) {
add_exclude_file(&local_exclude_list, fname,
- XFLG_WORD_SPLIT | XFLG_NO_PREFIXES);
+ XFLG_WORD_SPLIT | XFLG_WORDS_ONLY);
} else {
io_error |= IOERR_GENERAL;
rprintf(FINFO,
}
if (errno) {
io_error |= IOERR_GENERAL;
- rprintf(FERROR, "readdir(%s): (%d) %s\n",
- dir, errno, strerror(errno));
+ rsyserr(FERROR, errno, "readdir(%s)", dir);
}
closedir(d);
io_start_buffering_out(f);
if (filesfrom_fd >= 0) {
if (argv[0] && !push_dir(argv[0])) {
- rprintf(FERROR, "push_dir %s failed: %s\n",
- full_fname(argv[0]), strerror(errno));
+ rsyserr(FERROR, errno, "push_dir %s failed",
+ full_fname(argv[0]));
exit_cleanup(RERR_FILESELECT);
}
use_ff_fd = 1;
if (link_stat(fname, &st) != 0) {
if (f != -1) {
io_error |= IOERR_GENERAL;
- rprintf(FERROR, "link_stat %s failed: %s\n",
- full_fname(fname), strerror(errno));
+ rsyserr(FERROR, errno, "link_stat %s failed",
+ full_fname(fname));
}
continue;
}
if (!push_dir(dir)) {
io_error |= IOERR_GENERAL;
- rprintf(FERROR, "push_dir %s failed: %s\n",
- full_fname(dir), strerror(errno));
+ rsyserr(FERROR, errno, "push_dir %s failed",
+ full_fname(dir));
continue;
}
flist_dir = NULL;
flist_dir_len = 0;
if (!pop_dir(olddir)) {
- rprintf(FERROR, "pop_dir %s failed: %s\n",
- full_fname(dir), strerror(errno));
+ rsyserr(FERROR, errno, "pop_dir %s failed",
+ full_fname(dir));
exit_cleanup(RERR_FILESELECT);
}
}
if (!(c1 = (uchar*)f1->dirname)) {
state1 = fnc_BASE;
c1 = (uchar*)f1->basename;
+ } else if (!*c1) {
+ state1 = fnc_SLASH;
+ c1 = (uchar*)"/";
} else
state1 = fnc_DIR;
if (!(c2 = (uchar*)f2->dirname)) {
state2 = fnc_BASE;
c2 = (uchar*)f2->basename;
+ } else if (!*c2) {
+ state2 = fnc_SLASH;
+ c2 = (uchar*)"/";
} else
state2 = fnc_DIR;