From 9c2e6940f872b5eb50f55f0d3b1db7338251e1a8 Mon Sep 17 00:00:00 2001 From: dgaudet Date: Sun, 19 Jun 2005 20:38:39 +0000 Subject: 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 --- rdiff-backup/CHANGELOG | 3 +++ rdiff-backup/rdiff_backup/rpath.py | 18 ++++++++++++------ 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): -- cgit v1.2.1