summaryrefslogtreecommitdiff
path: root/read_cfg.c
diff options
context:
space:
mode:
authorlouie <lshprung@yahoo.com>2021-08-01 13:36:48 -0700
committerlouie <lshprung@yahoo.com>2021-08-01 13:36:48 -0700
commit77798c73c5ce16ef355436816514d703dfc84464 (patch)
tree8f84cb43840b8cb5fcc00425fe866190ea7d99e8 /read_cfg.c
parentadc0e1599ba2d5859f306424b864541869028708 (diff)
Fixed invalid config path crash
Diffstat (limited to 'read_cfg.c')
-rw-r--r--read_cfg.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/read_cfg.c b/read_cfg.c
index 61ddce1..77c4381 100644
--- a/read_cfg.c
+++ b/read_cfg.c
@@ -32,7 +32,8 @@ bool hr = false;
//turn foldCase (insensitive case searching) on or off; On by default
bool fold_case = true;
-void cfg_interp(char *path){
+//return false if invalid path
+bool cfg_interp(char *path){
FILE *fp;
char buffer[BUF_LEN];
GROUP **g;
@@ -43,7 +44,10 @@ void cfg_interp(char *path){
int j;
fp = fopen(path, "r");
- assert(fp != NULL);
+ if(fp == NULL){
+ printf("Error: Invalid Configuration Path \"%s\"\n", path);
+ return false;
+ }
//build the options array
char **options = malloc(sizeof(char *) * OPTION_CNT);
@@ -87,7 +91,7 @@ void cfg_interp(char *path){
*/
fclose(fp);
- return;
+ return true;
}
bool get_sort(){