Fix close/unlink order for file locking.
Reviewed in https://codereview.appspot.com/7313056/.
This commit is contained in:
@@ -142,8 +142,8 @@ class _PosixOpener(_Opener):
|
|||||||
"""Unlock a file by removing the .lock file, and close the handle."""
|
"""Unlock a file by removing the .lock file, and close the handle."""
|
||||||
if self._locked:
|
if self._locked:
|
||||||
lock_filename = self._posix_lockfile(self._filename)
|
lock_filename = self._posix_lockfile(self._filename)
|
||||||
os.unlink(lock_filename)
|
|
||||||
os.close(self._lock_fd)
|
os.close(self._lock_fd)
|
||||||
|
os.unlink(lock_filename)
|
||||||
self._locked = False
|
self._locked = False
|
||||||
self._lock_fd = None
|
self._lock_fd = None
|
||||||
if self._fh:
|
if self._fh:
|
||||||
|
|||||||
Reference in New Issue
Block a user