mirror of
https://github.com/openSUSE/osc.git
synced 2025-09-07 21:58:41 +02:00
handle mmap failure on filesystems like NTFS, which may not support
memory mapping when mounted under Linux
This commit is contained in:
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)
|
||||
|
||||
|
Reference in New Issue
Block a user