From 78a46ac7cbae997979d7c1394328d3d44f9f1df4 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Sun, 17 Mar 2019 20:41:05 +0100 Subject: Avoid deadlock in config_save() Must not exit with nbar.mutex locked. Addresses GitHub issue #201. Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/config.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/config.c b/src/config.c index a728c83..a6c5e59 100644 --- a/src/config.c +++ b/src/config.c @@ -633,9 +633,9 @@ static int config_load_cb(const char *key, const char *value, void *dummy) int result = config_set_conf(key, value); if (result < 0) { - WARN_MSG(_("unknown user option: \"%s\""), key); + WARN_MSG(_("unknown user option: \"%s\" (ignored)"), key); } else if (result == 0) { - WARN_MSG(_("invalid option format: \"%s\""), key); + WARN_MSG(_("invalid option format: \"%s\" (ignored)"), key); } return 1; @@ -655,12 +655,13 @@ static int config_save_cb(const char *key, const char *value, void *status) (struct config_save_status *)status); if (result < 0) { - EXIT(_("configuration variable unknown: \"%s\""), key); - /* NOTREACHED */ + WARN_MSG(_("unknown user option: \"%s\" (disabled)"), key); } else if (result == 0) { - EXIT(_("wrong configuration variable format for \"%s\""), - key); - /* NOTREACHED */ + WARN_MSG(_("invalid option format: \"%s\" (disabled)"), key); + } + if (result <= 0) { + fputc('#', ((struct config_save_status *)status)->fp); + buf = mem_strdup(value); } fputs(key, ((struct config_save_status *)status)->fp); -- cgit v1.2.3-70-g09d2