mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-25 19:52:12 +01:00
handle mmap failure on filesystems like NTFS, which may not support
memory mapping when mounted under Linux
This commit is contained in:
parent
5d57d7e299
commit
7b91075229
10
osc/core.py
10
osc/core.py
@ -1273,7 +1273,15 @@ def http_request(method, url, data=None, file=None):
|
||||
else:
|
||||
import mmap
|
||||
filefd = open(file, 'r+')
|
||||
data = mmap.mmap(filefd.fileno(), os.path.getsize(file))
|
||||
try:
|
||||
data = mmap.mmap(filefd.fileno(), os.path.getsize(file))
|
||||
except EnvironmentError, e:
|
||||
if e.errno == 19:
|
||||
sys.exit('\n\n%s\nThe file \'%s\' could not be memory mapped. It is ' \
|
||||
'\non a filesystem which does not support this.' % (e, file))
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
fd = urllib2.urlopen(req, data=data)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user