From 7e74a1d3d443df68a1a4be9ccce7439462c1531a Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 9 Jun 2019 11:52:36 -0700 Subject: Correct error messages for missing/invalid file passed to -config Now a non-existent file prints: Couldn't find configuration file "not-there" and a file that fails to parse prints: Couldn't parse configuration file "not-right" Fixes: #3, https://bugs.freedesktop.org/show_bug.cgi?id=101845 Signed-off-by: Alan Coopersmith --- setxkbmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setxkbmap.c b/setxkbmap.c index cf0f02d..3af641e 100644 --- a/setxkbmap.c +++ b/setxkbmap.c @@ -742,12 +742,15 @@ applyConfig(char *name) Bool ok; if ((fp = findFileInPath(name)) == NULL) + { + ERR1("Couldn't find configuration file \"%s\"\n", name); return False; + } ok = XkbCFParse(fp, XkbCFDflts, NULL, &cfgResult); fclose(fp); if (!ok) { - ERR1("Couldn't find configuration file \"%s\"\n", name); + ERR1("Couldn't parse configuration file \"%s\"\n", name); return False; } if (cfgResult.rules_file) -- cgit v1.2.3