diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-10-18 16:15:35 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-10-18 16:23:45 +0200 |
commit | 271c8ec50f48fae5523f8355b5233fa1db5c6a42 (patch) | |
tree | bef646f2665fe1f218fbc461799bd15a515feacf /src/locale/localectl.c | |
parent | sd-path: FOREACH_LINE exorcism (diff) | |
download | systemd-271c8ec50f48fae5523f8355b5233fa1db5c6a42.tar.xz systemd-271c8ec50f48fae5523f8355b5233fa1db5c6a42.zip |
localectl: FOREACH_LINE excorcism
Diffstat (limited to 'src/locale/localectl.c')
-rw-r--r-- | src/locale/localectl.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/locale/localectl.c b/src/locale/localectl.c index 88fd077e09..e2a9415138 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -280,7 +280,6 @@ static int set_x11_keymap(int argc, char **argv, void *userdata) { static int list_x11_keymaps(int argc, char **argv, void *userdata) { _cleanup_fclose_ FILE *f = NULL; _cleanup_strv_free_ char **list = NULL; - char line[LINE_MAX]; enum { NONE, MODELS, @@ -305,9 +304,16 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) { else assert_not_reached("Wrong parameter"); - FOREACH_LINE(line, f, break) { + for (;;) { + _cleanup_free_ char *line = NULL; char *l, *w; + r = read_line(f, LONG_LINE_MAX, &line); + if (r < 0) + return log_error_errno(r, "Failed to read keyboard mapping list: %m"); + if (r == 0) + break; + l = strstrip(line); if (isempty(l)) |