mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-27 07:06:13 +01:00
Do not mmap a cpio archive
There is simply no need for a mmap.
This commit is contained in:
parent
1c4385a579
commit
54ac438eb0
@ -147,16 +147,6 @@ class CpioRead:
|
||||
def read(self):
|
||||
if not self.__file:
|
||||
self.__file = open(self.filename, 'rb')
|
||||
try:
|
||||
if sys.platform[:3] != 'win':
|
||||
self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name), prot = mmap.PROT_READ)
|
||||
else:
|
||||
self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name))
|
||||
except EnvironmentError as e:
|
||||
if e.errno == 19 or ( hasattr(e, 'winerror') and e.winerror == 5 ):
|
||||
print('cannot use mmap to read the file, failing back to default', file=sys.stderr)
|
||||
else:
|
||||
raise e
|
||||
else:
|
||||
self.__file.seek(0, os.SEEK_SET)
|
||||
self._init_datastructs()
|
||||
|
Loading…
Reference in New Issue
Block a user