Skip to content
Snippets Groups Projects
Commit b19016dd authored by schneider's avatar schneider
Browse files

fix(config): only change file offset when consuming data

parent 79a731ba
No related branches found
No related tags found
1 merge request!339New config api with support for dynamic keys
...@@ -216,7 +216,7 @@ void load_config(void) ...@@ -216,7 +216,7 @@ void load_config(void)
char *eol = NULL; char *eol = NULL;
int last_eol = 0; int last_eol = 0;
while (line) { while (line) {
//line points one character past the las (if any) '\n' hence '- 1' //line points one character past the last (if any) '\n' hence '- 1'
last_eol = line - buf - 1; last_eol = line - buf - 1;
eol = strchr(line, '\n'); eol = strchr(line, '\n');
++line_number; ++line_number;
...@@ -250,14 +250,12 @@ void load_config(void) ...@@ -250,14 +250,12 @@ void load_config(void)
break; break;
} }
file_offset += seek_back;
int rc = epic_file_seek(fd, seek_back, SEEK_CUR); int rc = epic_file_seek(fd, seek_back, SEEK_CUR);
if (rc < 0) { if (rc < 0) {
LOG_ERR("card10.cfg", "seek failed, aborting"); LOG_ERR("card10.cfg", "seek failed, aborting");
return; return;
} }
char newline; char newline;
file_offset += 1;
rc = epic_file_read(fd, &newline, 1); rc = epic_file_read(fd, &newline, 1);
if (rc < 0 || newline != '\n') { if (rc < 0 || newline != '\n') {
LOG_ERR("card10.cfg", "seek failed, aborting"); LOG_ERR("card10.cfg", "seek failed, aborting");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment