summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordgaudet <dgaudet@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-06-19 20:38:39 +0000
committerdgaudet <dgaudet@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-06-19 20:38:39 +0000
commit9c2e6940f872b5eb50f55f0d3b1db7338251e1a8 (patch)
tree4c281dc73ecb99ad0ddb02db8a5c82ab3215e008
parent19ca3b4feb60d3ee32b02a1d099a28b1899abaf5 (diff)
downloadrdiff-backup-9c2e6940f872b5eb50f55f0d3b1db7338251e1a8.tar.gz
bug#12726: fix regressing of devices while running as non-root -- zero
length files are created as placeholders. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@591 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-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):