sysusers: convert to conf_file_read()
I was annoyed that systemd-sysusers doesn't print any info when it opens a config file. Its read_config_file() started out the same as the one in tmpfiles, and then they diverged. The one in tmpfiles has that logging, hence the rework to use it here too and get better logging. The two programs should provide similar functionality, so using a common helper will make it easier to extend them in tandem later. No functional change apart from the log info. The userdata argument (Context) is moved to the last position as requested in the review.
This commit is contained in:
@@ -439,12 +439,11 @@ int conf_file_read(
|
||||
if (IN_SET(line[0], 0, '#'))
|
||||
continue;
|
||||
|
||||
k = parse_line(fn, v, line, &invalid_line, userdata);
|
||||
if (k < 0 && invalid_line) {
|
||||
k = parse_line(fn, v, line, invalid_config ? &invalid_line : NULL, userdata);
|
||||
if (k < 0 && invalid_line)
|
||||
/* Allow reporting with a special code if the caller requested this. */
|
||||
if (invalid_config)
|
||||
*invalid_config = true;
|
||||
} else
|
||||
*invalid_config = true;
|
||||
else
|
||||
/* The first error, if any, becomes our return value. */
|
||||
RET_GATHER(r, k);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user