Added lockfile age check
This commit is contained in:
parent
932ce5d7a5
commit
cde220ead7
@ -7,6 +7,9 @@ $Id$
|
||||
|
||||
v0.37.5 12-Jul-2003
|
||||
|
||||
common.a:
|
||||
Node locking tests for non-stale lockfiles older then 6 hours.
|
||||
|
||||
|
||||
v0.37.4 10-May-2003 - 12-Jul-2003
|
||||
|
||||
|
11
TODO
11
TODO
@ -1,6 +1,6 @@
|
||||
$Id$
|
||||
|
||||
MBSE BBS V0.37.03 TODO list.
|
||||
MBSE BBS V0.37.05 TODO list.
|
||||
----------------------------
|
||||
|
||||
These are a list of things that must be implemented one way or
|
||||
@ -106,9 +106,6 @@ mbcico:
|
||||
|
||||
N: Implement binkp resync when getting files. Transmit works.
|
||||
|
||||
N: Add better check for stale outbound locks, check if the pid is from
|
||||
a non-mbse program or add a age check.
|
||||
|
||||
mbfile:
|
||||
N: Add a check to see if the magic filenames are (still) valid.
|
||||
|
||||
@ -133,12 +130,6 @@ mbaff:
|
||||
mbindex:
|
||||
N: Add usernames index.
|
||||
|
||||
mbmon:
|
||||
L: Logfile tail functions.
|
||||
|
||||
mbtask:
|
||||
N: Add events.
|
||||
|
||||
mbnewusr:
|
||||
N: On NetBSD, supress error message from mbpasswd.
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Node locking
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -39,11 +39,11 @@
|
||||
|
||||
int nodelock(faddr *addr)
|
||||
{
|
||||
char *fn,*tfn,*p;
|
||||
char tmp[16];
|
||||
char *fn, *tfn, *p, tmp[16];
|
||||
FILE *fp;
|
||||
pid_t pid, mypid;
|
||||
int tmppid, sverr;
|
||||
time_t ltime, now;
|
||||
|
||||
fn = bsyname(addr);
|
||||
tfn = xstrcpy(fn);
|
||||
@ -103,9 +103,17 @@ int nodelock(faddr *addr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stale or old lock tests
|
||||
*/
|
||||
ltime = file_time(fn);
|
||||
now = time(NULL);
|
||||
if (kill(pid, 0) && (errno == ESRCH)) {
|
||||
Syslog('+', "Found stale bsy file for %s, unlink", ascfnode(addr,0x1f));
|
||||
unlink(fn);
|
||||
} else if (((unsigned long)now - (unsigned long)ltime) > 21600) {
|
||||
Syslog('+', "Found lock older then 6 hours for %s, unlink", ascfnode(addr,0x1f));
|
||||
unlink(fn);
|
||||
} else {
|
||||
Syslog('+', "Node %s is locked by pid %d", ascfnode(addr, 0x1f), pid);
|
||||
unlink(tfn);
|
||||
|
Reference in New Issue
Block a user