From: hwangcc23 Date: Mon, 2 Nov 2015 14:12:44 +0000 (+0800) Subject: Fix config validation fail when no new line from end of file X-Git-Tag: 4.12~108^2 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=18b3f09970cf89a76e0d740740b0539eb8be02a7 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) --- 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");