Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2948:0e7a0e204f5d HEAD
If pid in dotlock file is same as ours, assume a stale lock file.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 07 Dec 2004 02:41:38 +0200 |
parents | a519f183bacf |
children | 05ae72649fd0 |
files | src/lib/file-dotlock.c |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/file-dotlock.c Tue Dec 07 02:26:01 2004 +0200 +++ b/src/lib/file-dotlock.c Tue Dec 07 02:41:38 2004 +0200 @@ -131,8 +131,13 @@ if (lock_info->have_pid) { /* we've local PID. Check if it exists. */ - if (kill(pid, 0) == 0 || errno != ESRCH) - return 0; + if (kill(pid, 0) == 0 || errno != ESRCH) { + if (pid != getpid()) + return 0; + /* it's us. either we're locking it again, or it's a + stale lock file with same pid than us. either way, + recreate it.. */ + } /* doesn't exist - go ahead and delete */ if (unlink(lock_info->lock_path) < 0 && errno != ENOENT) {