Merge branch 'master' into next

next
Michael Stapelberg 2011-09-20 21:42:51 +01:00
commit de7c2841ed
1 changed files with 5 additions and 2 deletions

View File

@ -433,12 +433,14 @@ void parse_file(const char *f) {
/* 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 (strstr(value, " ") == NULL && strstr(value, "\t") == NULL) {
(v_value = strstr(value, "\t")) == NULL) {
ELOG("Malformed variable assignment, need a value\n"); ELOG("Malformed variable assignment, need a value\n");
continue; continue;
} }
if (!(v_value = strstr(value, " ")))
v_value = strstr(value, "\t");
*(v_value++) = '\0'; *(v_value++) = '\0';
struct Variable *new = scalloc(sizeof(struct Variable)); struct Variable *new = scalloc(sizeof(struct Variable));
@ -463,6 +465,7 @@ void parse_file(const char *f) {
int extra = (strlen(current->value) - strlen(current->key)); int extra = (strlen(current->value) - strlen(current->key));
char *next; char *next;
for (next = bufcopy; for (next = bufcopy;
(bufcopy + (next - bufcopy)) < (buf + stbuf.st_size) &&
(next = strcasestr(bufcopy + (next - bufcopy), current->key)) != NULL; (next = strcasestr(bufcopy + (next - bufcopy), current->key)) != NULL;
next += strlen(current->key)) { next += strlen(current->key)) {
*next = '_'; *next = '_';