diff options
author | Filipe Brandenburger <filbranden@google.com> | 2018-05-09 18:10:07 -0700 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 0fdf8b0882bdce409ae3cbaf9517ad3ee06811e3 (patch) | |
tree | ba41430a1e1a0c35e28a859462cba795bc81ee41 /src/shared | |
parent | 7c630b45afffa7aa066cdd9b87cc4e7b32cdccd8 (diff) |
conf-parser: accept trailing backslash at the end of the file (#8941)
This makes it behave the same whether there is a blank line or not at
the end of the file. This is also consistent with the behavior of the
shell on a shell script that ends on a trailing backslash at the last
line.
Added tests to test_config_parse(), which only pass if the corresponding
change to config_parse() is included.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/conf-parser.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 704c75c3a..73591f70f 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -405,6 +405,27 @@ int config_parse(const char *unit, continuation = mfree(continuation); } + if (continuation) { + r = parse_line(unit, + filename, + ++line, + sections, + lookup, + table, + flags, + §ion, + §ion_line, + §ion_ignored, + continuation, + userdata); + if (r < 0) { + if (flags & CONFIG_PARSE_WARN) + log_warning_errno(r, "%s:%u: Failed to parse file: %m", filename, line); + return r; + + } + } + return 0; } |