Attempt to avoid a problem with --copy-unsafe-links where a symlink was
[rsync/rsync.git] / backup.c
index 8512e00..840bab7 100644 (file)
--- a/backup.c
+++ b/backup.c
@@ -98,7 +98,7 @@ static BOOL copy_valid_path(const char *fname)
                        rsyserr(FERROR, errno, "backup stat %s failed", full_fname(rel));
                else {
                        struct file_struct *file;
-                       if (!(file = make_file(rel, NULL, NULL, 0, NO_FILTERS)))
+                       if (!(file = make_file(rel, NULL, NULL, 0, NO_FILTERS, PHYS_DEPTH_N_A)))
                                continue;
 #ifdef SUPPORT_ACLS
                        if (preserve_acls && !S_ISLNK(file->mode)) {
@@ -221,7 +221,7 @@ int make_backup(const char *fname, BOOL prefer_rename)
        }
 
        /* Fall back to making a copy. */
-       if (!(file = make_file(fname, NULL, &sx.st, 0, NO_FILTERS)))
+       if (!(file = make_file(fname, NULL, &sx.st, 0, NO_FILTERS, PHYS_DEPTH_N_A)))
                return 1; /* the file could have disappeared */
 
 #ifdef SUPPORT_ACLS
@@ -252,7 +252,7 @@ int make_backup(const char *fname, BOOL prefer_rename)
 #ifdef SUPPORT_LINKS
        if (!ret && preserve_links && S_ISLNK(file->mode)) {
                const char *sl = F_SYMLINK(file);
-               if (safe_symlinks && unsafe_symlink(sl, fname)) {
+               if (safe_symlinks && unsafe_symlink(sl, path_depth(fname))) {
                        if (INFO_GTE(SYMSAFE, 1)) {
                                rprintf(FINFO, "ignoring unsafe symlink %s -> %s\n",
                                        full_fname(buf), sl);