From aa3c37e2f93a0a9810a81fdbf6f8d21602af1fc8 Mon Sep 17 00:00:00 2001 From: Ryan Zuklie Date: Fri, 30 Oct 2015 21:48:06 -0400 Subject: [PATCH 1/2] Added error handling for when config cant be accessed --- cava.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cava.c b/cava.c index 8ba41b0..6173ca7 100644 --- a/cava.c +++ b/cava.c @@ -113,7 +113,12 @@ void load_config() // config: create empty file strcat(configPath, configFile); FILE *fp = fopen(configPath, "ab+"); - fclose(fp); + if (fp) { + fclose(fp); + } else { + printf("Unable to access config '%s', exiting...\n", configPath); + exit(EXIT_FAILURE); + } // config: parse ini dictionary* ini = iniparser_load(configPath); From e1129179b7bb336a9d25c3ed40ec3d9f6de8ef43 Mon Sep 17 00:00:00 2001 From: Ryan Zuklie Date: Fri, 30 Oct 2015 21:55:25 -0400 Subject: [PATCH 2/2] Changed spaces to tabs --- cava.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cava.c b/cava.c index 6173ca7..e123c91 100644 --- a/cava.c +++ b/cava.c @@ -113,12 +113,12 @@ void load_config() // config: create empty file strcat(configPath, configFile); FILE *fp = fopen(configPath, "ab+"); - if (fp) { - fclose(fp); - } else { - printf("Unable to access config '%s', exiting...\n", configPath); + if (fp) { + fclose(fp); + } else { + print("Unable to access config '%s', exiting...\n", configPath); exit(EXIT_FAILURE); - } + } // config: parse ini dictionary* ini = iniparser_load(configPath);