Commit 9b737f6a authored by schneider's avatar schneider

fix(config): Calculate value offset correctly

I need unit tests :/
parent ffb1c4c1
Pipeline #4539 passed with stages
in 2 minutes and 19 seconds
......@@ -146,7 +146,8 @@ static void trim(char *str)
// parses one line of the config file
static void parse_line(char *line, int line_number, size_t line_offset)
{
char *line_start = line;
char *line_start = line;
char *value_start = strchr(line, '=') + 1;
trim(line);
......@@ -190,7 +191,7 @@ static void parse_line(char *line, int line_number, size_t line_offset)
return;
}
size_t value_offset = value - line_start + line_offset;
size_t value_offset = value_start - line_start + line_offset;
add_config_pair(key, value, line_number, value_offset);
}
......@@ -617,7 +618,7 @@ int epic_config_set_string(const char *key, const char *value_in)
}
}
complex_out:
complex_out:
if (fd1 >= 0) {
epic_file_close(fd1);
}
......@@ -634,7 +635,7 @@ int epic_config_set_string(const char *key, const char *value_in)
}
}
out:
out:
/* Reload config so the new key or the changed value is available */
load_config();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment