Merge pull request #452 from bebehei/fail-on-missing-config

Fail when config file given via option not found
This commit is contained in:
Nikos Tsipinakis 2017-12-06 16:41:44 +02:00 committed by GitHub
commit c04fce1461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,6 +79,13 @@ void load_settings(char *cmdline_config_path)
if (cmdline_config_path != NULL) { if (cmdline_config_path != NULL) {
config_file = fopen(cmdline_config_path, "r"); config_file = fopen(cmdline_config_path, "r");
if(!config_file) {
char *msg = g_strdup_printf(
"Cannot find config file: '%s'\n",
cmdline_config_path);
die(msg, 1);
}
} }
if (config_file == NULL) { if (config_file == NULL) {
config_file = xdgConfigOpen("dunst/dunstrc", "r", &xdg); config_file = xdgConfigOpen("dunst/dunstrc", "r", &xdg);