From a25aed50e637ee87c93acf904a5e22631623519f Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 29 Jul 2008 17:59:08 -0700 Subject: [PATCH] Make hard-linking work when a device has an st_dev of 0. --- NEWS | 3 +++ flist.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 1488c623..efddfe8f 100644 --- 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 9b69d921..f90ae291 100644 --- 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; } -- 2.34.1