diff options
| author | bwarsaw | 2000-09-14 05:11:59 +0000 |
|---|---|---|
| committer | bwarsaw | 2000-09-14 05:11:59 +0000 |
| commit | 1612591fff2e61fd1d90bf05c723911a17dd7c05 (patch) | |
| tree | 8107c55790edc959c80bcc471279d4e421b8709d /Mailman/LockFile.py | |
| parent | e037ef2eb64378879125f3d61e76e5a369557f16 (diff) | |
| download | mailman-1612591fff2e61fd1d90bf05c723911a17dd7c05.tar.gz mailman-1612591fff2e61fd1d90bf05c723911a17dd7c05.tar.zst mailman-1612591fff2e61fd1d90bf05c723911a17dd7c05.zip | |
locked(): Suppose we try to touch() the lock file, but we don't own
it, and in fact our alter-ego owns the file (e.g. the cgi process or
shell account uid if we're mail). The utime() call will fail with an
EPERM which wasn't being caught. Catch it here and return 0 since we
obviously don't own the lock.
TBD: should other calls to __touch() be similarly wrapped?
Diffstat (limited to 'Mailman/LockFile.py')
| -rw-r--r-- | Mailman/LockFile.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Mailman/LockFile.py b/Mailman/LockFile.py index 39b1cd1c7..60b9d8e4d 100644 --- a/Mailman/LockFile.py +++ b/Mailman/LockFile.py @@ -311,7 +311,15 @@ class LockFile: helps avoid race conditions during the lock status test. """ # Discourage breaking the lock for a while. - self.__touch() + try: + self.__touch() + except OSError, e: + if e.errno == errno.EPERM: + # We can't touch the file because we're not the owner. I + # don't see how we can own the lock if we're not the owner. + return 0 + else: + raise # TBD: can the link count ever be > 2? if self.__linkcount() <> 2: return 0 |
