Mention the fix to --safe-links/--copy-unsafe-links.
[rsync/rsync.git] / backup.c
index 8b813b0..ecc40d5 100644 (file)
--- a/backup.c
+++ b/backup.c
@@ -2,7 +2,7 @@
  * Backup handling code.
  *
  * Copyright (C) 1999 Andrew Tridgell
- * Copyright (C) 2003-2008 Wayne Davison
+ * Copyright (C) 2003-2009 Wayne Davison
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -244,14 +244,12 @@ static int keep_backup(const char *fname)
        /* Check to see if this is a device file, or link */
        if ((am_root && preserve_devices && IS_DEVICE(file->mode))
         || (preserve_specials && IS_SPECIAL(file->mode))) {
-               uint32 *devp = F_RDEV_P(file);
                int save_errno;
-               dev_t rdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
                do_unlink(buf);
-               if (do_mknod(buf, file->mode, rdev) < 0) {
+               if (do_mknod(buf, file->mode, sx.st.st_rdev) < 0) {
                        save_errno = errno ? errno : EINVAL; /* 0 paranoia */
                        if (errno == ENOENT && make_bak_dir(buf) == 0) {
-                               if (do_mknod(buf, file->mode, rdev) < 0)
+                               if (do_mknod(buf, file->mode, sx.st.st_rdev) < 0)
                                        save_errno = errno ? errno : save_errno;
                                else
                                        save_errno = 0;
@@ -297,7 +295,7 @@ static int keep_backup(const char *fname)
 #ifdef SUPPORT_LINKS
        if (!kept && preserve_links && S_ISLNK(file->mode)) {
                const char *sl = F_SYMLINK(file);
-               if (safe_symlinks && unsafe_symlink(sl, buf)) {
+               if (safe_symlinks && unsafe_symlink(sl, fname)) {
                        if (verbose) {
                                rprintf(FINFO, "ignoring unsafe symlink %s -> %s\n",
                                        full_fname(buf), sl);