1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-06 13:18:42 +02:00

add more checks when working with mmap.mmap

This commit is contained in:
Pavol Rusnak
2009-05-22 14:43:39 +00:00
parent 5f19030580
commit e97c1de936
3 changed files with 6 additions and 3 deletions

View File

@@ -152,7 +152,7 @@ class Ar:
else:
self.__file = mmap.mmap(self.__file.fileno(), 0)
except EnvironmentError, e:
if e.errno == 19:
if e.errno == 19 or ( hasattr(e, 'winerror') and e.winerror == 5 ):
print >>sys.stderr, 'cannot use mmap to read the file, falling back to the default io'
else:
raise e

View File

@@ -144,8 +144,8 @@ class Cpio:
self.__file = mmap.mmap(self.__file.fileno(), 0, prot = mmap.PROT_READ)
else:
self.__file = mmap.mmap(self.__file.fileno(), 0)
except EnvironmentError, e:
if e.errno == 19:
except: EnvironmentError, e:
if e.errno == 19 or ( hasattr(e, 'winerror') and e.winerror == 5 ):
print >>sys.stderr, 'cannot use mmap to read the file, failing back to default'
else:
raise e