summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rdiff-backup/CHANGELOG3
-rw-r--r--rdiff-backup/rdiff_backup/rpath.py18
2 files changed, 15 insertions, 6 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index 2584fb8..85542d5 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -9,6 +9,9 @@ as filenames in the metadata file (LF => \n and \ => \\).
Fix from Paul P Komkoff Jr for uid typo in text_to_entrytuple.
+bug#12726: fix regressing of devices while running as non-root -- zero
+length files are created as placeholders.
+
New in v0.13.6 (2005/04/07)
---------------------------
diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py
index e672b28..6ac1c2c 100644
--- a/rdiff-backup/rdiff_backup/rpath.py
+++ b/rdiff-backup/rdiff_backup/rpath.py
@@ -35,7 +35,7 @@ are dealing with are local or remote.
"""
-import os, stat, re, sys, shutil, gzip, socket, time
+import os, stat, re, sys, shutil, gzip, socket, time, errno
import Globals, Time, static, log, user_group
@@ -1017,12 +1017,18 @@ class RPath(RORPath):
def makedev(self, type, major, minor):
"""Make a special file with specified type, and major/minor nums"""
- cmdlist = ['mknod', self.path, type, str(major), str(minor)]
- if self.conn.os.spawnvp(os.P_WAIT, 'mknod', cmdlist) != 0:
- raise RPathException("Error running %s" % cmdlist)
- if type == 'c': datatype = 'chr'
- elif type == 'b': datatype = 'blk'
+ if type == 'c':
+ datatype = 'chr'
+ mode = stat.S_IFCHR | 0600
+ elif type == 'b':
+ datatype = 'blk'
+ mode = stat.S_IFBLK | 0600
else: raise RPathException
+ try: self.conn.os.mknod(self.path, mode, self.conn.os.makedev(major, minor))
+ except OSError, e:
+ if e.errno == errno.EPERM:
+ log.Log("unable to mknod %s -- using touch instead" % self.path, 4)
+ self.touch()
self.setdata()
def fsync(self, fp = None):