Browse Source

added update_interval check to config_check()

Aaron Marcher 10 years ago
parent
commit
d4d2646f63
1 changed files with 9 additions and 1 deletions
  1. 9 1
      slstatus.c

+ 9 - 1
slstatus.c

@@ -42,9 +42,17 @@ int
 config_check()
 config_check()
 {
 {
     struct stat fs;
     struct stat fs;
+
+    /* check all files in the config.h file */
     CHECK_FILE(batterynowfile, fs);
     CHECK_FILE(batterynowfile, fs);
     CHECK_FILE(batteryfullfile, fs);
     CHECK_FILE(batteryfullfile, fs);
     CHECK_FILE(tempfile, fs);
     CHECK_FILE(tempfile, fs);
+
+    /* check update interval */
+    if (update_interval < 1)
+        return -1;
+
+    /* exit successfully */
     return 0;
     return 0;
 }
 }
 
 
@@ -337,7 +345,7 @@ main()
 
 
     /* check config for sanity */
     /* check config for sanity */
     if (config_check() < 0) {
     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);
         exit(1);
     }
     }