Bugfix: Accept '\t' in the 'set' command, don’t die but ELOG in case of errors (Thanks atsutane)

This commit is contained in:
Michael Stapelberg 2011-08-25 21:58:03 +02:00
parent b7a3d8505b
commit f06059ec94
1 changed files with 9 additions and 4 deletions

View File

@ -350,13 +350,18 @@ void parse_file(const char *f) {
continue; continue;
if (strcasecmp(key, "set") == 0) { if (strcasecmp(key, "set") == 0) {
if (value[0] != '$') if (value[0] != '$') {
die("Malformed variable assignment, name has to start with $\n"); ELOG("Malformed variable assignment, name has to start with $\n");
continue;
}
/* get key/value for this variable */ /* get key/value for this variable */
char *v_key = value, *v_value; char *v_key = value, *v_value;
if ((v_value = strstr(value, " ")) == NULL) if ((v_value = strstr(value, " ")) == NULL &&
die("Malformed variable assignment, need a value\n"); (v_value = strstr(value, "\t")) == NULL) {
ELOG("Malformed variable assignment, need a value\n");
continue;
}
*(v_value++) = '\0'; *(v_value++) = '\0';