From: Michael Stapelberg Date: Tue, 20 Sep 2011 20:42:09 +0000 (+0100) Subject: Bugfix: Correctly split key/value when parsing variables (Thanks xeen) X-Git-Tag: 4.1~143^2^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e1949aa69421ff6e8a540eb505ac5d00dee403a0;p=i3%2Fi3 Bugfix: Correctly split key/value when parsing variables (Thanks xeen) --- diff --git a/src/cfgparse.y b/src/cfgparse.y index 10ca48cc..f8e84ae9 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -358,12 +358,14 @@ void parse_file(const char *f) { /* get key/value for this variable */ char *v_key = value, *v_value; - if ((v_value = strstr(value, " ")) == NULL && - (v_value = strstr(value, "\t")) == NULL) { + if (strstr(value, " ") == NULL && strstr(value, "\t") == NULL) { ELOG("Malformed variable assignment, need a value\n"); continue; } + if (!(v_value = strstr(value, " "))) + v_value = strstr(value, "\t"); + *(v_value++) = '\0'; struct Variable *new = scalloc(sizeof(struct Variable));