On some platforms (i.e. kFreeBSD), the st_rdev value isn't completely
stable. For example, given "date > foo; cp -a foo foo-2", the st_rdev
value may differ between the two files.
Since we only need the st_rdev value for the call to mknod() when
restoring character and block special files, set it to zero for
anything else.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
def _add_common(self, path, st):
self.uid = st.st_uid
self.gid = st.st_gid
- self.rdev = st.st_rdev
self.atime = st.st_atime
self.mtime = st.st_mtime
self.ctime = st.st_ctime
if entry:
self.group = entry.gr_name
self.mode = st.st_mode
+ # Only collect st_rdev if we might need it for a mknod()
+ # during restore. On some platforms (i.e. kFreeBSD), it isn't
+ # stable for other file types. For example "cp -a" will
+ # change it for a plain file.
+ if stat.S_ISCHR(st.st_mode) or stat.S_ISBLK(st.st_mode):
+ self.rdev = st.st_rdev
+ else:
+ self.rdev = 0
def _same_common(self, other):
"""Return true or false to indicate similarity in the hardlink sense."""