summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2019-03-17 20:41:05 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2019-03-21 06:41:46 +0100
commit78a46ac7cbae997979d7c1394328d3d44f9f1df4 (patch)
tree6131fd6623f2ce5966c41b2c3ae577588869eb46
parentd26164fb725e22f8eebd8d94ad59cab3921b8a6f (diff)
downloadcalcurse-78a46ac7cbae997979d7c1394328d3d44f9f1df4.tar.gz
calcurse-78a46ac7cbae997979d7c1394328d3d44f9f1df4.zip
Avoid deadlock in config_save()
Must not exit with nbar.mutex locked. Addresses GitHub issue #201. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
-rw-r--r--src/config.c15
1 files 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);