From b1bbcfee1956714070ed055a04050d67b1f29190 Mon Sep 17 00:00:00 2001 From: bescoto Date: Thu, 1 Sep 2005 01:55:27 +0000 Subject: Stop python v2.2 from choking on device files git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@629 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 2 ++ rdiff-backup/rdiff_backup/rpath.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index 00e75af..f6a7057 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -20,6 +20,8 @@ bug#14209: Security bug with --restrict-read-only and outside path. Bug with --restrict option allowed writes outside path. (Reported by Charles Duffy.) +bug #14304: Python 2.2 compatibility spoiled by device files. + New in v1.0.0 (2005/08/14) -------------------------- diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py index 05249ec..aa411a0 100644 --- a/rdiff-backup/rdiff_backup/rpath.py +++ b/rdiff-backup/rdiff_backup/rpath.py @@ -1045,8 +1045,10 @@ class RPath(RORPath): 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: + except (OSError, AttributeError), e: + if isinstance(e, AttributeError) or e.errno == errno.EPERM: + # AttributeError will be raised by Python 2.2, which + # doesn't have os.mknod log.Log("unable to mknod %s -- using touch instead" % self.path, 4) self.touch() self.setdata() -- cgit v1.2.1