diff options
-rw-r--r-- | degesch.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -12683,7 +12683,7 @@ load_configuration_file (const char *filename, struct error **e) struct error *error = NULL; if (!(root = config_item_parse (data.str, data.len, false, &error))) { - error_set (e, "Configuration parse error: %s", error->message); + error_set (e, "Parsing `%s' failed: %s", filename, error->message); error_free (error); } end: @@ -12744,6 +12744,10 @@ load_default_aliases (struct app_context *ctx) static void load_configuration (struct app_context *ctx) { + // In theory, we could ensure that only one instance is running by locking + // the configuration file and ensuring here that it exists. This is + // however brittle, as it may be unlinked without the application noticing. + struct config_item *root = NULL; struct error *e = NULL; @@ -12758,11 +12762,10 @@ load_configuration (struct app_context *ctx) if (e) { log_global_error (ctx, "#s", e->message); + log_global_error (ctx, + "Please either fix the configuration file or remove it", filename); error_free (e); - - // That would be somewhat undesired - config_item_get (ctx->config.root, "behaviour.save_on_quit", NULL) - ->value.boolean = false; + exit (EXIT_FAILURE); } if (root) |