From b19016dd4123e5761c5c2665af58f89f99637231 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Sun, 10 Nov 2019 17:06:49 +0100
Subject: [PATCH] fix(config): only change file offset when consuming data

---
 epicardium/modules/config.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/epicardium/modules/config.c b/epicardium/modules/config.c
index 2e334db1..6b8bdafc 100644
--- a/epicardium/modules/config.c
+++ b/epicardium/modules/config.c
@@ -216,7 +216,7 @@ void load_config(void)
 		char *eol    = NULL;
 		int last_eol = 0;
 		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;
 			eol      = strchr(line, '\n');
 			++line_number;
@@ -250,14 +250,12 @@ void load_config(void)
 				break;
 			}
 
-			file_offset += seek_back;
 			int rc = epic_file_seek(fd, seek_back, SEEK_CUR);
 			if (rc < 0) {
 				LOG_ERR("card10.cfg", "seek failed, aborting");
 				return;
 			}
 			char newline;
-			file_offset += 1;
 			rc = epic_file_read(fd, &newline, 1);
 			if (rc < 0 || newline != '\n') {
 				LOG_ERR("card10.cfg", "seek failed, aborting");
-- 
GitLab