Skip to content

Commit a960063

Browse files
keszybzbluca
authored andcommitted
shared/conf-parser: do not print "(null)" as section name
Before: /etc/kernel/install.conf:6: Unknown key name 'asdf' in section '(null)', ignoring. After: /etc/kernel/install.conf:6: Unknown key 'asdf', ignoring. Also make the message a bit better. (cherry picked from commit 600a740) (cherry picked from commit a2f32b9) (cherry picked from commit 1d83c17)
1 parent a347500 commit a960063

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/shared/conf-parser.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ static int next_assignment(
155155
/* Warn about unknown non-extension fields. */
156156
if (!(flags & CONFIG_PARSE_RELAXED) && !startswith(lvalue, "X-"))
157157
log_syntax(unit, LOG_WARNING, filename, line, 0,
158-
"Unknown key name '%s' in section '%s', ignoring.", lvalue, section);
158+
"Unknown key '%s'%s%s%s, ignoring.",
159+
lvalue,
160+
section ? " in section [" : "",
161+
strempty(section),
162+
section ? "]" : "");
159163

160164
return 0;
161165
}

0 commit comments

Comments
 (0)