Commit d369d71f6af3107eb8d47849a678a0ce45799757

Edward Thomson 2015-04-21T17:18:35

config: peek returns '\n' on EOF; handle in write

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/config_file.c b/src/config_file.c
index 0f9141a..010c494 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1423,7 +1423,7 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
 	while (!reader->eof) {
 		c = reader_peek(reader, SKIP_WHITESPACE);
 
-		if (c == '\0') { /* We've arrived at the end of the file */
+		if (c == '\n') { /* We've arrived at the end of the file */
 			break;
 
 		} else if (c == '[') { /* section header, new section begins */