changeset 2728:486a5dbbc9c8 HEAD

Check that dotlock PID exists even if we don't do stale lock timeouting.
author Timo Sirainen <tss@iki.fi>
date Mon, 11 Oct 2004 16:05:24 +0300
parents 8c82376938a8
children 26d266d8a2bb
files src/lib/file-dotlock.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/file-dotlock.c	Mon Oct 11 15:22:25 2004 +0300
+++ b/src/lib/file-dotlock.c	Mon Oct 11 16:05:24 2004 +0300
@@ -98,11 +98,6 @@
 		return 1;
 	}
 
-	if (lock_info->stale_timeout == 0) {
-		/* no change checking */
-		return 0;
-	}
-
 	if (lock_info->ino != st.st_ino ||
 	    !CMP_DEV_T(lock_info->dev, st.st_dev) ||
 	    lock_info->ctime != st.st_ctime ||
@@ -134,7 +129,6 @@
 		lock_info->have_pid = pid != -1;
 	}
 
-	/* re-read the PID every time, because */
 	if (lock_info->have_pid) {
 		/* we've local PID. Check if it exists. */
 		if (kill(pid, 0) == 0 || errno != ESRCH)
@@ -148,6 +142,11 @@
 		return 1;
 	}
 
+	if (lock_info->stale_timeout == 0) {
+		/* no change checking */
+		return 0;
+	}
+
 	if (lock_info->last_change != now) {
 		if (stat(lock_info->path, &st) < 0) {
 			if (errno == ENOENT) {