]> jfr.im git - irc/quakenet/newserv.git/blobdiff - glines/glines_store.c
BUILD: add require-all build mode
[irc/quakenet/newserv.git] / glines / glines_store.c
index 0e44d8387181a3d3d9adb8162dd01e942a74fa99..a52f51bc4151f7129ec0437773b3ac0fde66b9a5 100644 (file)
@@ -1,8 +1,11 @@
 #include <stdio.h>
+#include "../lib/version.h"
 #include "../core/schedule.h"
 #include "../control/control.h"
 #include "glines.h"
 
+MODULE_VERSION("");
+
 static int glstore_savefile(const char *file) {
   FILE *fp;
   gline *gl;
@@ -19,7 +22,7 @@ static int glstore_savefile(const char *file) {
     fprintf(fp, "%s %jd,%jd,%jd,%d,%s,%s\n",
       glinetostring(gl), (intmax_t)gl->expire, (intmax_t)gl->lastmod, (intmax_t)gl->lifetime,
       (gl->flags & GLINE_ACTIVE) ? 1 : 0,
-      gl->creator->content, gl->reason->content);
+      gl->creator->content, gl->reason ? gl->reason->content : "");
     count++;
   }
 
@@ -71,6 +74,8 @@ static int glstore_loadfile(const char *file) {
     glinelist = gl;
   }
 
+  fclose(fp);
+
   return count;
 }