diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-10-19 08:44:51 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 08:44:51 +0900 |
commit | 17acb7ef9a9d812a130543676aa705772afcccb7 (patch) | |
tree | d16a254bb2d29eb51ac16742a6cd6b6b8fa1cf6b /src/locale | |
parent | 218b4609d0b4c8dda8f14a36162f10e3b4fc27bd (diff) | |
parent | 2a98ae4a05d764d4280abb9e9a13335d4f2be3c3 (diff) | |
download | systemd-17acb7ef9a9d812a130543676aa705772afcccb7.tar.gz |
Merge pull request #10450 from poettering/foreach-line-excorcism
FOREACH_LINE excorcism
Diffstat (limited to 'src/locale')
-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)) |