int get_kernel_consoles(char ***ret) {
_cleanup_strv_free_ char **l = NULL;
_cleanup_free_ char *line = NULL;
- const char *p;
int r;
assert(ret);
- /* If /sys is mounted read-only this means we are running in some kind of container environment. In that
- * case /sys would reflect the host system, not us, hence ignore the data we can read from it. */
+ /* If /sys/ is mounted read-only this means we are running in some kind of container environment.
+ * In that case /sys/ would reflect the host system, not us, hence ignore the data we can read from it. */
if (path_is_read_only_fs("/sys") > 0)
goto fallback;
if (r < 0)
return r;
- p = line;
- for (;;) {
+ for (const char *p = line;;) {
_cleanup_free_ char *tty = NULL, *path = NULL;
r = extract_first_word(&p, &tty, NULL, 0);
}
*ret = TAKE_PTR(l);
-
- return 0;
+ return strv_length(*ret);
fallback:
r = strv_extend(&l, "/dev/console");
return r;
*ret = TAKE_PTR(l);
-
return 0;
}