if (!dest_path || list_only)
return NULL;
- if (daemon_filter_list.head
- && (check_filter(&daemon_filter_list, dest_path, 0 != 0) < 0
- || check_filter(&daemon_filter_list, dest_path, 1 != 0) < 0)) {
- rprintf(FERROR, "skipping daemon-excluded destination \"%s\"\n",
- dest_path);
- exit_cleanup(RERR_FILESELECT);
+ if (daemon_filter_list.head) {
+ char *slash = strrchr(dest_path, '/');
+ if (slash && slash[1] == '\0')
+ *slash = '\0';
+ else
+ slash = NULL;
+ if (check_filter(&daemon_filter_list, FLOG, dest_path, 0) < 0
+ || check_filter(&daemon_filter_list, FLOG, dest_path, 1) < 0) {
+ rprintf(FERROR, "skipping daemon-excluded destination \"%s\"\n",
+ dest_path);
+ exit_cleanup(RERR_FILESELECT);
+ }
+ if (slash)
+ *slash = '/';
}
/* See what currently exists at the destination. */
if ((statret = do_stat(dest_path, &st)) == 0) {
/* If the destination is a dir, enter it and use mode 1. */
if (S_ISDIR(st.st_mode)) {
- if (!push_dir(dest_path, 0)) {
- rsyserr(FERROR, errno, "push_dir#1 %s failed",
+ if (!change_dir(dest_path, CD_NORMAL)) {
+ rsyserr(FERROR, errno, "change_dir#1 %s failed",
full_fname(dest_path));
exit_cleanup(RERR_FILESELECT);
}
dry_run++;
}
- if (!push_dir(dest_path, dry_run > 1)) {
- rsyserr(FERROR, errno, "push_dir#2 %s failed",
+ if (!change_dir(dest_path, dry_run > 1 ? CD_SKIP_CHDIR : CD_NORMAL)) {
+ rsyserr(FERROR, errno, "change_dir#2 %s failed",
full_fname(dest_path));
exit_cleanup(RERR_FILESELECT);
}
dest_path = "/";
*cp = '\0';
- if (!push_dir(dest_path, 0)) {
- rsyserr(FERROR, errno, "push_dir#3 %s failed",
+ if (!change_dir(dest_path, CD_NORMAL)) {
+ rsyserr(FERROR, errno, "change_dir#3 %s failed",
full_fname(dest_path));
exit_cleanup(RERR_FILESELECT);
}
}
if (!relative_paths) {
- if (!push_dir(dir, 0)) {
- rsyserr(FERROR, errno, "push_dir#3 %s failed",
+ if (!change_dir(dir, CD_NORMAL)) {
+ rsyserr(FERROR, errno, "change_dir#3 %s failed",
full_fname(dir));
exit_cleanup(RERR_FILESELECT);
}
char *dir = argv[0];
argc--;
argv++;
- if (!am_daemon && !push_dir(dir, 0)) {
- rsyserr(FERROR, errno, "push_dir#4 %s failed",
+ if (!am_daemon && !change_dir(dir, CD_NORMAL)) {
+ rsyserr(FERROR, errno, "change_dir#4 %s failed",
full_fname(dir));
exit_cleanup(RERR_FILESELECT);
}
char *dir = *dir_p;
if (*dir == '/')
dir += module_dirlen;
- if (check_filter(elp, dir, 1) < 0)
+ if (check_filter(elp, FLOG, dir, 1) < 0)
goto options_rejected;
}
if (partial_dir && *partial_dir == '/'
- && check_filter(elp, partial_dir + module_dirlen, 1) < 0) {
+ && check_filter(elp, FLOG, partial_dir + module_dirlen, 1) < 0) {
options_rejected:
rprintf(FERROR,
"Your options have been rejected by the server.\n");
SIGACTION(SIGXFSZ, SIG_IGN);
#endif
- /* Initialize push_dir here because on some old systems getcwd
+ /* Initialize change_dir() here because on some old systems getcwd
* (implemented by forking "pwd" and reading its output) doesn't
* work when there are other child processes. Also, on all systems
* that implement getcwd that way "pwd" can't be found after chroot. */
- push_dir(NULL, 0);
+ change_dir(NULL, CD_NORMAL);
init_flist();
read_stream_flags(batch_fd);
else
write_stream_flags(batch_fd);
-
}
if (write_batch < 0)
dry_run = 1;