diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-07-18 16:12:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-18 16:12:20 +0200 |
commit | ffc1c1193843492780f12c1f8b9374f237edc7a5 (patch) | |
tree | 0b93301f20461cfe988f7ff46d0775424e85ffde | |
parent | 31a83062fb77875e8a670568559ae74d94e70738 (diff) | |
parent | 28f30f4051c3424b5f0757c76856a1102763e04f (diff) | |
download | systemd-ffc1c1193843492780f12c1f8b9374f237edc7a5.tar.gz |
Merge pull request #13107 from keszybz/lvalue-rvalue
Better error messages for syntax errors
-rw-r--r-- | src/shared/conf-parser.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 62fc1c97b7..a495c2538b 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -138,7 +138,8 @@ static int next_assignment( /* Warn about unknown non-extension fields. */ if (!(flags & CONFIG_PARSE_RELAXED) && !startswith(lvalue, "X-")) - log_syntax(unit, LOG_WARNING, filename, line, 0, "Unknown lvalue '%s' in section '%s', ignoring", lvalue, section); + log_syntax(unit, LOG_WARNING, filename, line, 0, + "Unknown key name '%s' in section '%s', ignoring.", lvalue, section); return 0; } @@ -239,7 +240,6 @@ static int parse_line( } if (sections && !*section) { - if (!(flags & CONFIG_PARSE_RELAXED) && !*section_ignored) log_syntax(unit, LOG_WARNING, filename, line, 0, "Assignment outside of section. Ignoring."); @@ -247,10 +247,12 @@ static int parse_line( } e = strchr(l, '='); - if (!e) { - log_syntax(unit, LOG_WARNING, filename, line, 0, "Missing '='."); - return -EINVAL; - } + if (!e) + return log_syntax(unit, LOG_WARNING, filename, line, 0, + "Missing '=', ignoring line."); + if (e == l) + return log_syntax(unit, LOG_WARNING, filename, line, 0, + "Missing key name before '=', ignoring line."); *e = 0; e++; |