diff options
Diffstat (limited to 'src/char/geoip.c')
-rw-r--r-- | src/char/geoip.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/char/geoip.c b/src/char/geoip.c index 889958e16..5d3324ab2 100644 --- a/src/char/geoip.c +++ b/src/char/geoip.c @@ -145,18 +145,20 @@ void geoip_init(void) } // Search database type - fseek(db, -3l, SEEK_END); - for (i = 0; i < GEOIP_STRUCTURE_INFO_MAX_SIZE; i++) { - if (fread(delim, sizeof(delim[0]), 3, db) != 3) { - db_type = 0; - break; - } - if (delim[0] == 255 && delim[1] == 255 && delim[2] == 255) { - if (fread(&db_type, sizeof(db_type), 1, db) != 1) { + if (fseek(db, -3l, SEEK_END) != 0) { + db_type = 0; + } else { + for (i = 0; i < GEOIP_STRUCTURE_INFO_MAX_SIZE; i++) { + if (fread(delim, sizeof(delim[0]), 3, db) != 3) { db_type = 0; + break; + } + if (delim[0] == 255 && delim[1] == 255 && delim[2] == 255) { + if (fread(&db_type, sizeof(db_type), 1, db) != 1) { + db_type = 0; + } + break; } - break; - } else { if (fseek(db, -4l, SEEK_CUR) != 0) { db_type = 0; break; |