Added more program locks
This commit is contained in:
parent
709a2ad3af
commit
3c0de46dc9
16
ChangeLog
16
ChangeLog
@ -36,6 +36,22 @@ v0.37.5 12-Jul-2003
|
|||||||
Added program locking, only one mbmon can run at the same time
|
Added program locking, only one mbmon can run at the same time
|
||||||
to prevent troubles with chat and sysop available.
|
to prevent troubles with chat and sysop available.
|
||||||
|
|
||||||
|
mbaff:
|
||||||
|
Added program locking to prevent that more than one mbaff can
|
||||||
|
run at the same time.
|
||||||
|
|
||||||
|
mball:
|
||||||
|
Added program locking to prevent that more than one mball can
|
||||||
|
run at the same time.
|
||||||
|
|
||||||
|
mbfile:
|
||||||
|
Added program locking to prevent that more than one mbfile can
|
||||||
|
run at the same time.
|
||||||
|
|
||||||
|
mbuser:
|
||||||
|
Added program locking to prevent that more than one mbuser can
|
||||||
|
run at the same time.
|
||||||
|
|
||||||
lang:
|
lang:
|
||||||
Added language prompts 18 and 19.
|
Added language prompts 18 and 19.
|
||||||
|
|
||||||
|
@ -30,15 +30,11 @@
|
|||||||
|
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "../lib/libs.h"
|
#include "../lib/libs.h"
|
||||||
//#include "../lib/memwatch.h"
|
|
||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
#include "../lib/users.h"
|
#include "../lib/users.h"
|
||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
//#include "../lib/dbcfg.h"
|
|
||||||
//#include "../lib/dbftn.h"
|
|
||||||
//#include "../lib/mberrors.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern int do_quiet; /* Quiet flag */
|
extern int do_quiet; /* Quiet flag */
|
||||||
@ -141,8 +137,6 @@ void ulockprogram(char *progname)
|
|||||||
|
|
||||||
if (oldpid == getpid()) {
|
if (oldpid == getpid()) {
|
||||||
(void)unlink(lockfile);
|
(void)unlink(lockfile);
|
||||||
} else {
|
|
||||||
WriteError("Lockfile owned by pid %d, not removed", oldpid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(lockfile);
|
free(lockfile);
|
||||||
|
@ -78,6 +78,7 @@ void die(int onsig)
|
|||||||
WriteError("Terminated with error %d", onsig);
|
WriteError("Terminated with error %d", onsig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ulockprogram((char *)"mbaff");
|
||||||
t_end = time(NULL);
|
t_end = time(NULL);
|
||||||
Syslog(' ', "MBAFF finished in %s", t_elapsed(t_start, t_end));
|
Syslog(' ', "MBAFF finished in %s", t_elapsed(t_start, t_end));
|
||||||
|
|
||||||
@ -113,15 +114,13 @@ int main(int argc, char **argv)
|
|||||||
* Catch all signals we can, and ignore the rest.
|
* Catch all signals we can, and ignore the rest.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) ||
|
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) ||
|
|
||||||
(i == SIGKILL))
|
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argc < 2)
|
if (argc < 2)
|
||||||
Help();
|
Help();
|
||||||
|
|
||||||
cmd = xstrcpy((char *)"Command line: mbaff");
|
cmd = xstrcpy((char *)"Command line: mbaff");
|
||||||
@ -155,6 +154,12 @@ int main(int argc, char **argv)
|
|||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(MBERR_DISK_FULL);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
|
if (lockprogram((char *)"mbaff")) {
|
||||||
|
if (!do_quiet)
|
||||||
|
printf("Can't lock mbaff, abort.\n");
|
||||||
|
die(MBERR_NO_PROGLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
memset(&MsgBase, 0, sizeof(MsgBase));
|
memset(&MsgBase, 0, sizeof(MsgBase));
|
||||||
|
|
||||||
if (do_announce)
|
if (do_announce)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose: File Database Maintenance
|
* Purpose: File Database Maintenance
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -218,6 +218,12 @@ int main(int argc, char **argv)
|
|||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(MBERR_DISK_FULL);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
|
if (lockprogram((char *)"mbfile")) {
|
||||||
|
if (!do_quiet)
|
||||||
|
printf("Can't lock mbfile, abort.\n");
|
||||||
|
die(MBERR_NO_PROGLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
if (do_adopt) {
|
if (do_adopt) {
|
||||||
AdoptFile(Area, FileName, Description);
|
AdoptFile(Area, FileName, Description);
|
||||||
die(MBERR_OK);
|
die(MBERR_OK);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose: File Database Maintenance - utilities
|
* Purpose: File Database Maintenance - utilities
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -95,6 +95,7 @@ void die(int onsig)
|
|||||||
WriteError("Terminated with error %d", onsig);
|
WriteError("Terminated with error %d", onsig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ulockprogram((char *)"mbfile");
|
||||||
t_end = time(NULL);
|
t_end = time(NULL);
|
||||||
Syslog(' ', "MBFILE finished in %s", t_elapsed(t_start, t_end));
|
Syslog(' ', "MBFILE finished in %s", t_elapsed(t_start, t_end));
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ void die(int onsig)
|
|||||||
WriteError("Terminated with error %d", onsig);
|
WriteError("Terminated with error %d", onsig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ulockprogram((char *)"mball");
|
||||||
t_end = time(NULL);
|
t_end = time(NULL);
|
||||||
Syslog(' ', "MBALL finished in %s", t_elapsed(t_start, t_end));
|
Syslog(' ', "MBALL finished in %s", t_elapsed(t_start, t_end));
|
||||||
|
|
||||||
@ -190,6 +191,12 @@ int main(int argc, char **argv)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lockprogram((char *)"mball")) {
|
||||||
|
if (!do_quiet)
|
||||||
|
printf("Can't lock mball, abort.\n");
|
||||||
|
die(MBERR_NO_PROGLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
if (do_list) {
|
if (do_list) {
|
||||||
Masterlist();
|
Masterlist();
|
||||||
if (do_zip)
|
if (do_zip)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: User Pack Util
|
* Purpose ...............: User Pack Util
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -111,12 +111,19 @@ int main(int argc, char **argv)
|
|||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
ExitClient(MBERR_DISK_FULL);
|
ExitClient(MBERR_DISK_FULL);
|
||||||
|
|
||||||
|
if (lockprogram((char *)"mbuser")) {
|
||||||
|
if (!do_quiet)
|
||||||
|
printf("Can't lock mbuser, abort.\n");
|
||||||
|
ExitClient(MBERR_NO_PROGLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
oldmask = umask(027);
|
oldmask = umask(027);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
colour(3, 0);
|
colour(3, 0);
|
||||||
UserPack(Days, Level, pack);
|
UserPack(Days, Level, pack);
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
|
|
||||||
|
ulockprogram((char *)"mbuser");
|
||||||
t_end = time(NULL);
|
t_end = time(NULL);
|
||||||
Syslog(' ', "MBUSER finished in %s", t_elapsed(t_start, t_end));
|
Syslog(' ', "MBUSER finished in %s", t_elapsed(t_start, t_end));
|
||||||
|
|
||||||
|
@ -788,8 +788,6 @@ void ulocktask(void)
|
|||||||
|
|
||||||
if (oldpid == getpid()) {
|
if (oldpid == getpid()) {
|
||||||
(void)unlink(lockfile);
|
(void)unlink(lockfile);
|
||||||
} else {
|
|
||||||
WriteError("Lockfile owned by pid %d, not removed", oldpid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(lockfile);
|
free(lockfile);
|
||||||
|
Reference in New Issue
Block a user