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:
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user