Merge pull request #13107 from keszybz/lvalue-rvalue
Better error messages for syntax errors
This commit is contained in:
commit
ffc1c11938
|
@ -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++;
|
||||
|
|
Loading…
Reference in a new issue