]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/recdb.c
Return an error if an extended ban is invalid
[irc/evilnet/x3.git] / src / recdb.c
index 024bc9a7eb78c98161247f678fcf05bc012943eb..f42284cdb30770a2ac07897c78df9d71d7cd0cdc 100644 (file)
@@ -93,7 +93,7 @@ typedef struct recdb_outfile {
 } RECDB_OUT;
 
 #ifdef HAVE_MMAP
-static int mmap_error=0;
+static int mmap_error;
 #endif
 
 #define EOL '\n'
@@ -617,9 +617,13 @@ parse_database(const char *filename)
 
     if (fstat(fileno(recdb.f), &statinfo)) {
         log_module(MAIN_LOG, LOG_ERROR, "Unable to fstat database file '%s': %s", filename, strerror(errno));
+        fclose(recdb.f);
         return NULL;
     }
     recdb.length = (size_t)statinfo.st_size;
+    if (recdb.length == 0) {
+        return alloc_database();
+    }
 
 #ifdef HAVE_MMAP
     /* Try mmap */