Attempt to avoid a problem with --copy-unsafe-links where a symlink was
[rsync/rsync.git] / generator.c
index acf4b88..48ef16c 100644 (file)
@@ -1354,7 +1354,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
        if (preserve_links && S_ISLNK(file->mode)) {
 #ifdef SUPPORT_LINKS
                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(NAME, 1)) {
                                if (solo_file)
                                        fname = f_name(file, NULL);
@@ -1644,7 +1644,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                if (inplace && make_backups > 0 && fnamecmp_type == FNAMECMP_FNAME) {
                        if (!(backupptr = get_backup_name(fname)))
                                goto cleanup;
-                       if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
+                       if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS, PHYS_DEPTH_N_A)))
                                goto pretend_missing;
                        if (copy_file(fname, backupptr, -1, back_file->mode) < 0) {
                                unmake_file(back_file);
@@ -1682,7 +1682,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                        close(fd);
                        goto cleanup;
                }
-               if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
+               if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS, PHYS_DEPTH_N_A))) {
                        close(fd);
                        goto pretend_missing;
                }