From 639c39cc33ba1323bc97c873834dca0390154eba Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sun, 23 Mar 1997 05:08:34 +0000 Subject: [PATCH] Make global lockfile actually work git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1485 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/otp/otp_db.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/otp/otp_db.c b/lib/otp/otp_db.c index 7ab673ade..e6700bc85 100644 --- a/lib/otp/otp_db.c +++ b/lib/otp/otp_db.c @@ -60,10 +60,12 @@ otp_db_open (void) close(lock); break; } - if (time(NULL) - statbuf.st_mtime > OTP_DB_TIMEOUT) - unlink (OTP_DB_LOCK); - else - sleep (1); + if (stat (OTP_DB_LOCK, &statbuf) == 0) { + if (time(NULL) - statbuf.st_mtime > OTP_DB_TIMEOUT) + unlink (OTP_DB_LOCK); + else + sleep (1); + } } if (i == RETRIES) return NULL;