summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/char/inter.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/char/inter.c b/src/char/inter.c
index 8b6368e9d..972407ef3 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -454,14 +454,15 @@ const char* geoip_getcountry(uint32 ipnum){
* Disables GeoIP
* frees geoip.cache
**/
-void geoip_final( void ) {
- if( geoip.cache ) {
+void geoip_final(bool shutdown) {
+ if (geoip.cache) {
aFree(geoip.cache);
geoip.cache = NULL;
}
- if( geoip.active ) {
- ShowStatus("GeoIP "CL_RED"disabled"CL_RESET".\n");
+ if (geoip.active) {
+ if (!shutdown)
+ ShowStatus("GeoIP "CL_RED"disabled"CL_RESET".\n");
geoip.active = false;
}
}
@@ -483,20 +484,20 @@ void geoip_init(void) {
db = fopen("./db/GeoIP.dat","rb");
if( db == NULL ) {
ShowError("geoip_readdb: Error reading GeoIP.dat!\n");
- geoip_final();
+ geoip_final(false);
return;
}
fno = fileno(db);
if( fstat(fno, &bufa) < 0 ) {
ShowError("geoip_readdb: Error stating GeoIP.dat! Error %d\n", errno);
- geoip_final();
+ geoip_final(false);
return;
}
geoip.cache = aMalloc( (sizeof(geoip.cache) * bufa.st_size) );
if( fread(geoip.cache, sizeof(unsigned char), bufa.st_size, db) != bufa.st_size ) {
ShowError("geoip_cache: Couldn't read all elements!\n");
fclose(db);
- geoip_final();
+ geoip_final(false);
return;
}
@@ -520,7 +521,7 @@ void geoip_init(void) {
else
ShowError("geoip_init(): GeoIP is corrupted!\n");
- geoip_final();
+ geoip_final(false);
return;
}
ShowStatus("Finished Reading "CL_GREEN"GeoIP"CL_RESET" Database.\n");
@@ -1044,7 +1045,7 @@ void inter_final(void)
inter_mail_sql_final();
inter_auction_sql_final();
- geoip_final();
+ geoip_final(true);
do_final_msg();
return;
}