diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-06-24 14:57:58 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-06-24 14:57:58 +0900 |
commit | 6abdec98f38f457797d666586d117070ccf4e31f (patch) | |
tree | c6188d26e24fd296612e3b377d2eb9db6e9f05c8 /src/basic/terminal-util.c | |
parent | 623550aff7f290a180473cd1a713f1c5ba882d8a (diff) | |
download | systemd-6abdec98f38f457797d666586d117070ccf4e31f.tar.gz |
tree-wide: use _cleanup_ attribute and strv_consume() + TAKE_PTR()
Diffstat (limited to 'src/basic/terminal-util.c')
-rw-r--r-- | src/basic/terminal-util.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index aa69bede6f..76d6d1a20c 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -720,8 +720,7 @@ int get_kernel_consoles(char ***ret) { p = line; for (;;) { - _cleanup_free_ char *tty = NULL; - char *path; + _cleanup_free_ char *tty = NULL, *path = NULL; r = extract_first_word(&p, &tty, NULL, 0); if (r < 0) @@ -736,17 +735,16 @@ int get_kernel_consoles(char ***ret) { return r; } - path = strappend("/dev/", tty); + path = path_join("/dev", tty); if (!path) return -ENOMEM; if (access(path, F_OK) < 0) { log_debug_errno(errno, "Console device %s is not accessible, skipping: %m", path); - free(path); continue; } - r = strv_consume(&l, path); + r = strv_consume(&l, TAKE_PTR(path)); if (r < 0) return r; } |