added update_interval check to config_check()
authorAaron Marcher <info@nulltime.net>
Thu, 10 Mar 2016 14:50:35 +0000 (15:50 +0100)
committerAaron Marcher (drkhsh) <info@nulltime.net>
Thu, 10 Mar 2016 14:50:35 +0000 (15:50 +0100)
slstatus.c

index 86d27eb010533460aa2b361f552c6b2493af4ed6..23ed940a55cae6efc09ab4581c666b100dd76b3d 100644 (file)
@@ -42,9 +42,17 @@ int
 config_check()
 {
     struct stat fs;
+
+    /* check all files in the config.h file */
     CHECK_FILE(batterynowfile, fs);
     CHECK_FILE(batteryfullfile, fs);
     CHECK_FILE(tempfile, fs);
+
+    /* check update interval */
+    if (update_interval < 1)
+        return -1;
+
+    /* exit successfully */
     return 0;
 }
 
@@ -337,7 +345,7 @@ main()
 
     /* check config for sanity */
     if (config_check() < 0) {
-        fprintf(stderr, "Config error, please check paths and recompile\n");
+        fprintf(stderr, "Config error, please check paths and interval and recompile!\n");
         exit(1);
     }