From 18b3f09970cf89a76e0d740740b0539eb8be02a7 Mon Sep 17 00:00:00 2001 From: hwangcc23 Date: Mon, 2 Nov 2015 22:12:44 +0800 Subject: [PATCH] Fix config validation fail when no new line from end of file 1. i3 config validation failed when the new line is missing from the end of file. The error was: "ERROR: Your line continuation is too long, it exceeds 4096 bytes". It is wrong to assume that there is always a '\n' at the end of each line in the config file. (Not for the last line.) Fix it via adding a end-of-file check. 2. See the issue #2051. (https://github.com/i3/i3/issues/2051) --- src/config_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config_parser.c b/src/config_parser.c index 0f3d33ec..27cdeb93 100644 --- a/src/config_parser.c +++ b/src/config_parser.c @@ -843,7 +843,7 @@ bool parse_file(const char *f, bool use_nagbar) { break; die("Could not read configuration file\n"); } - if (buffer[strlen(buffer) - 1] != '\n') { + if (buffer[strlen(buffer) - 1] != '\n' && !feof(fstr)) { ELOG("Your line continuation is too long, it exceeds %zd bytes\n", sizeof(buffer)); } continuation = strstr(buffer, "\\\n"); -- 2.39.5