Make global lockfile actually work

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1485 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-03-23 05:08:34 +00:00
parent c8bfd588e5
commit 639c39cc33

View File

@@ -60,10 +60,12 @@ otp_db_open (void)
close(lock); close(lock);
break; break;
} }
if (time(NULL) - statbuf.st_mtime > OTP_DB_TIMEOUT) if (stat (OTP_DB_LOCK, &statbuf) == 0) {
unlink (OTP_DB_LOCK); if (time(NULL) - statbuf.st_mtime > OTP_DB_TIMEOUT)
else unlink (OTP_DB_LOCK);
sleep (1); else
sleep (1);
}
} }
if (i == RETRIES) if (i == RETRIES)
return NULL; return NULL;