dir = fname;
fname = p + 1;
}
- } else if (implied_dirs && (p=strrchr(fname,'/')) && p != fname) {
+ } else if ((p = strstr(fname, "/./")) != NULL) {
+ *p = '\0';
+ if (p == fname)
+ dir = "/";
+ else
+ dir = fname;
+ fname = p + 3;
+ }
+
+ if (!*fname)
+ fname = ".";
+
+ if (dir && *dir) {
+ static char *lastdir;
+ static int lastdir_len;
+
+ strcpy(olddir, curr_dir); /* can't overflow */
+
+ if (!push_dir(dir)) {
+ io_error |= IOERR_GENERAL;
+ rsyserr(FERROR, errno, "push_dir %s failed",
+ full_fname(dir));
+ continue;
+ }
+
+ if (lastdir && strcmp(lastdir, dir) == 0) {
+ flist_dir = lastdir;
+ flist_dir_len = lastdir_len;
+ } else {
+ flist_dir = lastdir = strdup(dir);
+ flist_dir_len = lastdir_len = strlen(dir);
+ }
+ }
+
+ if (implied_dirs && (p=strrchr(fname,'/')) && p != fname) {
/* Send the implied directories at the start of the
* source spec, so we get their permissions right. */
char *lp = lastpath, *fn = fname, *slash = fname;
}
}
- if (!*fname)
- fname = ".";
-
- if (dir && *dir) {
- static char *lastdir;
- static int lastdir_len;
-
- strcpy(olddir, curr_dir); /* can't overflow */
-
- if (!push_dir(dir)) {
- io_error |= IOERR_GENERAL;
- rsyserr(FERROR, errno, "push_dir %s failed",
- full_fname(dir));
- continue;
- }
-
- if (lastdir && strcmp(lastdir, dir) == 0) {
- flist_dir = lastdir;
- flist_dir_len = lastdir_len;
- } else {
- flist_dir = lastdir = strdup(dir);
- flist_dir_len = lastdir_len = strlen(dir);
- }
- }
-
if (one_file_system)
filesystem_dev = st.st_dev;