summaryrefslogtreecommitdiff
path: root/app/cwm
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2014-01-28 00:42:21 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2014-01-28 00:42:21 +0000
commit363c2b2baf4e53b9f6524a22e00d97dd4e197c66 (patch)
treeef09c78d0dfb0fcb3538e79686f4f31e91714f4e /app/cwm
parent455fcb0b8e2ab508c077b9fd9ef36d097d6c6c12 (diff)
Move conf_init/clear into main - no behaviour change; from Tiago Cunha.
Diffstat (limited to 'app/cwm')
-rw-r--r--app/cwm/calmwm.c7
-rw-r--r--app/cwm/parse.y9
2 files changed, 7 insertions, 9 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c
index 9faf7b666..2add0d4f3 100644
--- a/app/cwm/calmwm.c
+++ b/app/cwm/calmwm.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.c,v 1.86 2014/01/22 22:26:05 okan Exp $
+ * $OpenBSD: calmwm.c,v 1.87 2014/01/28 00:42:20 okan Exp $
*/
#include <sys/param.h>
@@ -108,8 +108,11 @@ main(int argc, char **argv)
}
conf_init(&Conf);
- if (conf_path && (parse_config(conf_path, &Conf) == -1))
+ if (conf_path && (parse_config(conf_path, &Conf) == -1)) {
warnx("config file %s has errors, not loading", conf_path);
+ conf_clear(&Conf);
+ conf_init(&Conf);
+ }
free(conf_path);
x_init(display_name);
diff --git a/app/cwm/parse.y b/app/cwm/parse.y
index 5af650b37..33d49a08b 100644
--- a/app/cwm/parse.y
+++ b/app/cwm/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.53 2014/01/27 14:49:40 okan Exp $ */
+/* $OpenBSD: parse.y,v 1.54 2014/01/28 00:42:20 okan Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -545,7 +545,7 @@ popfile(void)
int
parse_config(const char *filename, struct conf *xconf)
{
- int errors = 0;
+ int errors = 0;
conf = xconf;
@@ -558,10 +558,5 @@ parse_config(const char *filename, struct conf *xconf)
errors = file->errors;
popfile();
- if (errors) {
- conf_clear(conf);
- conf_init(conf);
- }
-
return (errors ? -1 : 0);
}