Browse Source

degesch: die on configuration parse errors

Seems more sensible.
tags/v0.9.5
Přemysl Janouch 3 years ago
parent
commit
483ab39e3c
Signed by: Přemysl Janouch <p.janouch@gmail.com> GPG Key ID: B715679E3A361BE6
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      degesch.c

+ 8
- 5
degesch.c View File

@@ -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)

Loading…
Cancel
Save