Remove stale nodeinuse files

This commit is contained in:
Andrew Pamment 2017-09-06 17:33:27 +10:00
parent 6e567179ba
commit d170675f21

11
main.c
View File

@ -914,6 +914,7 @@ void server(int port) {
int i; int i;
int on = 1; int on = 1;
char str[INET6_ADDRSTRLEN]; char str[INET6_ADDRSTRLEN];
struct stat s;
#if defined(ENABLE_WWW) #if defined(ENABLE_WWW)
www_daemon = NULL; www_daemon = NULL;
#endif #endif
@ -922,6 +923,16 @@ void server(int port) {
printf("Magicka BBS Server Starting....\n"); printf("Magicka BBS Server Starting....\n");
} }
for (i=1;i<=conf.nodes;i++) {
snprintf(buffer, 1024, "%s/nodeinuse.%d", conf.bbs_path, i);
if (stat(buffer, &s) == 0) {
if (!conf.fork) {
printf(" - Removing stale file: nodeinuse.%d\n", i);
}
unlink(buffer);
}
}
if (conf.ipguard_enable) { if (conf.ipguard_enable) {
ip_guard_map = hashmap_new(); ip_guard_map = hashmap_new();