conf-parse: small prettification

Let's use first_word() instead of startswith(), it's more explanatory
and a bit more correct. Also, let's use the return value instead of
adding +9 when looking for the second part of the directive.
This commit is contained in:
Lennart Poettering
2018-02-23 20:50:22 +01:00
parent 41b283d0f1
commit bdc8e623bb

View File

@@ -180,7 +180,7 @@ static int parse_line(
char *l,
void *userdata) {
char *e;
char *e, *include;
assert(filename);
assert(line > 0);
@@ -194,7 +194,8 @@ static int parse_line(
if (strchr(COMMENTS "\n", *l))
return 0;
if (startswith(l, ".include ")) {
include = first_word(l, ".include");
if (include) {
_cleanup_free_ char *fn = NULL;
/* .includes are a bad idea, we only support them here
@@ -215,7 +216,7 @@ static int parse_line(
".include directives are deprecated, and support for them will be removed in a future version of systemd. "
"Please use drop-in files instead.");
fn = file_in_same_dir(filename, strstrip(l+9));
fn = file_in_same_dir(filename, strstrip(include));
if (!fn)
return -ENOMEM;