diff options
author | R. David Murray <rdmurray@bitdance.com> | 2011-03-03 18:03:36 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2011-03-03 18:03:36 (GMT) |
commit | 91221f2857961cfed3411e5c49cfa256d9c6a3f8 (patch) | |
tree | 05554ae447559157a8c274c06baf77a17b73e844 /Lib/mailbox.py | |
parent | acdad9a40b4c1d5d70c5d5966cbea61126bdc04e (diff) | |
download | cpython-91221f2857961cfed3411e5c49cfa256d9c6a3f8.zip cpython-91221f2857961cfed3411e5c49cfa256d9c6a3f8.tar.gz cpython-91221f2857961cfed3411e5c49cfa256d9c6a3f8.tar.bz2 |
#11306: Treat EROFS like EACCES when making a 'file is read-only' decision
Diffstat (limited to 'Lib/mailbox.py')
-rw-r--r-- | Lib/mailbox.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index 2a0d321..ace1709 100644 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -578,7 +578,7 @@ class _singlefileMailbox(Mailbox): f = open(self._path, 'wb+') else: raise NoSuchMailboxError(self._path) - elif e.errno == errno.EACCES: + elif e.errno in (errno.EACCES, errno.EROFS): f = open(self._path, 'rb') else: raise @@ -2002,7 +2002,7 @@ def _lock_file(f, dotlock=True): try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError as e: - if e.errno in (errno.EAGAIN, errno.EACCES): + if e.errno in (errno.EAGAIN, errno.EACCES, errno.EROFS): raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: @@ -2012,7 +2012,7 @@ def _lock_file(f, dotlock=True): pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() except IOError as e: - if e.errno == errno.EACCES: + if e.errno in (errno.EACCES, errno.EROFS): return # Without write access, just skip dotlocking. else: raise |