1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

sysusers: FOREACH_LINE excorcism

This commit is contained in:
Lennart Poettering 2018-10-18 16:18:52 +02:00
parent 8ac3c9ab1b
commit 050ca29963

View File

@ -1681,7 +1681,6 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
static int read_config_file(const char *fn, bool ignore_enoent) {
_cleanup_fclose_ FILE *rf = NULL;
FILE *f = NULL;
char line[LINE_MAX];
unsigned v = 0;
int r = 0;
@ -1701,10 +1700,17 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
f = rf;
}
FOREACH_LINE(line, f, break) {
for (;;) {
_cleanup_free_ char *line = NULL;
char *l;
int k;
k = read_line(f, LONG_LINE_MAX, &line);
if (k < 0)
return log_error_errno(k, "Failed to read '%s': %m", fn);
if (k == 0)
break;
v++;
l = strstrip(line);