Skip to content

Commit

Permalink
Fixed #8403 -- Changed the use of fcntl.flock() to fcntl.lockf(). On …
Browse files Browse the repository at this point in the history
…some

systems, this will ensure fnctl-based file locking is always used, which means
locking of NFS-mounted files should work.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8675 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Aug 28, 2008
1 parent f96b124 commit 1954202
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django/core/files/locks.py
Expand Up @@ -54,10 +54,10 @@ def unlock(file):
win32file.UnlockFileEx(hfile, 0, -0x10000, __overlapped) win32file.UnlockFileEx(hfile, 0, -0x10000, __overlapped)
elif system_type == 'posix': elif system_type == 'posix':
def lock(file, flags): def lock(file, flags):
fcntl.flock(fd(file), flags) fcntl.lockf(fd(file), flags)


def unlock(file): def unlock(file):
fcntl.flock(fd(file), fcntl.LOCK_UN) fcntl.lockf(fd(file), fcntl.LOCK_UN)
else: else:
# File locking is not supported. # File locking is not supported.
LOCK_EX = LOCK_SH = LOCK_NB = None LOCK_EX = LOCK_SH = LOCK_NB = None
Expand Down

0 comments on commit 1954202

Please sign in to comment.