summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/settings.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/settings.c b/src/settings.c
index 670bcc0..c8bcbfe 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -113,10 +113,7 @@ void BarSettingsDestroy (BarSettings_t *settings) {
* @return nothing yet
*/
void BarSettingsRead (BarSettings_t *settings) {
- char *configfiles[] = {PACKAGE "/state", PACKAGE "/config"},
- path[PATH_MAX], key[256], val[256];
- FILE *configfd;
- static const char *formatMsgPrefix = "format_msg_";
+ char *configfiles[] = {PACKAGE "/state", PACKAGE "/config"};
assert (sizeof (settings->keys) / sizeof (*settings->keys) ==
sizeof (dispatchActions) / sizeof (*dispatchActions));
@@ -166,6 +163,10 @@ void BarSettingsRead (BarSettings_t *settings) {
/* read config files */
for (size_t j = 0; j < sizeof (configfiles) / sizeof (*configfiles); j++) {
+ static const char *formatMsgPrefix = "format_msg_";
+ char key[256], val[256], path[PATH_MAX];
+ FILE *configfd;
+
BarGetXdgConfigDir (configfiles[j], path, sizeof (path));
if ((configfd = fopen (path, "r")) == NULL) {
continue;
@@ -316,6 +317,8 @@ void BarSettingsRead (BarSettings_t *settings) {
}
}
}
+
+ fclose (configfd);
}
/* check environment variable if proxy is not set explicitly */
@@ -325,8 +328,6 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->proxy = strdup (tmpProxy);
}
}
-
- fclose (configfd);
}
/* write statefile