Added lock timeout to mbmail, increased flag logging

This commit is contained in:
Michiel Broek 2001-11-14 19:50:27 +00:00
parent 8ec45db58a
commit 1febff88c3
3 changed files with 36 additions and 5 deletions

View File

@ -4299,3 +4299,8 @@ v0.33.19 26-Oct-2001
import:
Removed users import, could not work anymore.
mbfido:
When running in mbmail mode, it will try to get the lock on
the program for 10 minutes before aborting.

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: msgflags.c
* $Id$
* Purpose ...............: MBSE BBS Mail Gate
* Last modification date : 06-Jun-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -128,7 +127,7 @@ int flag_on(char *flag, char *flags)
char *p,*tok;
int up=0;
Syslog('M', "checking flag \"%s\" in string \"%s\"",MBSE_SS(flag),MBSE_SS(flags));
Syslog('m', "checking flag \"%s\" in string \"%s\"",MBSE_SS(flag),MBSE_SS(flags));
if (flags == NULL)
return 0;
p=xstrcpy(flags);
@ -137,7 +136,7 @@ int flag_on(char *flag, char *flags)
up = 1;
}
free(p);
Syslog('M', "flag%s present",up?"":" not");
Syslog('m', "flag%s present",up?"":" not");
return up;
}

View File

@ -412,8 +412,35 @@ int main(int argc, char **argv)
if (!diskfree(CFG.freespace))
die(101);
if (lockunpack())
if (do_mail) {
/*
* Try to get a lock for a long time, another mbfido may be legally
* running since mbmail is started by the MTA instead of by mbtask.
* The timeout is 10 minutes. If mbmail times out, the MTA will
* bounce the message. What happens during the time we wait is
* unknown, will the MTA be patient enough?
*/
i = 30;
while (TRUE) {
if (lockunpack() == 0)
break;
i--;
if (! i) {
WriteError("Lock timeout, aborting");
die(101);
}
sleep(20);
Nopper();
}
} else {
/*
* Started under control of mbtask, that means if there is a lock then
* there is something wrong; abort.
*/
if (lockunpack())
die(101);
}
if (initnl())
die(101);
if (!do_mail && !do_uucp)