summaryrefslogtreecommitdiffstats
path: root/src/sysusers
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-18 16:18:52 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-18 16:23:45 +0200
commit050ca2996388d681d12b4be78511764b1839a92f (patch)
tree39029b4064452b63a352e1b31d13660c6214a493 /src/sysusers
parentinstall: pass encountered error number to log_syntax() (diff)
downloadsystemd-050ca2996388d681d12b4be78511764b1839a92f.tar.xz
systemd-050ca2996388d681d12b4be78511764b1839a92f.zip
sysusers: FOREACH_LINE excorcism
Diffstat (limited to 'src/sysusers')
-rw-r--r--src/sysusers/sysusers.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 91722408da..0c9902adf6 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -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);