aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authorokan2018-02-02 13:27:25 +0000
committerokan2018-02-02 13:27:25 +0000
commitf4c2ff2f29a17a5916e9bf642240abb5f4fc190a (patch)
tree7f5262cb2b9e2f06da679964554b40b8e0e4e2f6 /parse.y
parent0e4de00f0797b3ead070279aa9e6994cebfe6c25 (diff)
downloadcwm-f4c2ff2f29a17a5916e9bf642240abb5f4fc190a.tar.gz
Simplification; use asprintf where appropriate now.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y12
1 files changed, 7 insertions, 5 deletions
diff --git a/parse.y b/parse.y
index b8a72cb..0c1972c 100644
--- a/parse.y
+++ b/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.69 2017/12/29 20:03:46 okan Exp $ */
+/* $OpenBSD: parse.y,v 1.70 2018/02/02 13:27:25 okan Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -137,22 +137,24 @@ main : FONTNAME STRING {
conf->snapdist = $2;
}
| COMMAND STRING string {
- if (!conf_cmd_add(conf, $2, $3)) {
- yyerror("command name/path too long");
+ if (strlen($3) >= PATH_MAX) {
+ yyerror("%s command path too long", $2);
free($2);
free($3);
YYERROR;
}
+ conf_cmd_add(conf, $2, $3);
free($2);
free($3);
}
| WM STRING string {
- if (!conf_wm_add(conf, $2, $3)) {
- yyerror("wm name/path too long");
+ if (strlen($3) >= PATH_MAX) {
+ yyerror("%s wm path too long", $2);
free($2);
free($3);
YYERROR;
}
+ conf_wm_add(conf, $2, $3);
free($2);
free($3);
}