aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-07-23 20:00:40 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2016-07-23 20:00:40 +0200
commit483ab39e3ca9033aaca83ccd2c17d4a59fd4fa76 (patch)
treebb36cc16fe255d4be29ff31b69f4c43256450a8e
parentbeaf1a1f82fe7127bfa6e478d7da91b2657d6692 (diff)
downloadxK-483ab39e3ca9033aaca83ccd2c17d4a59fd4fa76.tar.gz
xK-483ab39e3ca9033aaca83ccd2c17d4a59fd4fa76.tar.xz
xK-483ab39e3ca9033aaca83ccd2c17d4a59fd4fa76.zip
degesch: die on configuration parse errors
Seems more sensible.
-rw-r--r--degesch.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/degesch.c b/degesch.c
index 1d6e597..f394a3c 100644
--- a/degesch.c
+++ b/degesch.c
@@ -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)