Make hard-linking work when a device has an st_dev of 0.
authorWayne Davison <wayned@samba.org>
Wed, 30 Jul 2008 00:59:08 +0000 (17:59 -0700)
committerWayne Davison <wayned@samba.org>
Wed, 30 Jul 2008 01:08:51 +0000 (18:08 -0700)
NEWS
flist.c

diff --git a/NEWS b/NEWS
index 1488c623408b8de0fdd1a62471f0ca69fd17ee52..efddfe8f3f50d6ecc83d3a85a43310ec1a4521b3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ Changes since 3.0.3:
     - Fixed a bug in the hard-linking code where it would sometimes try to
       allocate 0 bytes of memory (which fails on some OSes, such as AIX).
 
+    - Fixed the hard-linking of files from a device that has a device number
+      of 0 (which seems to be a common device number on NetBSD).
+
     - Fixed a couple issues in the --fake-super handling of xattrs when the
       destination files have root-level attributes (e.g. selinux values) that
       a non-root copy can't affect.
diff --git a/flist.c b/flist.c
index 9b69d9211a4233a175e90e020d308767648d4514..f90ae291dc5b753b2503f8cf94bc6b27ea994abd 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -1213,8 +1213,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
                if (protocol_version >= 28
                 ? (!S_ISDIR(st.st_mode) && st.st_nlink > 1)
                 : S_ISREG(st.st_mode)) {
-                       tmp_dev = st.st_dev;
-                       tmp_ino = st.st_ino;
+                       tmp_dev = (int64)st.st_dev + 1;
+                       tmp_ino = (int64)st.st_ino;
                } else
                        tmp_dev = 0;
        }