1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 14:55:37 +03:00

localectl: FOREACH_LINE excorcism

This commit is contained in:
Lennart Poettering 2018-10-18 16:15:35 +02:00
parent 710bf2aeb2
commit 271c8ec50f

View File

@ -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))