Currently it returns a full path in some cases and a partial path in others.
Let's make sure it always returns a full path.
tty = active;
}
- if (tty != active)
- return strdup_to(ret, tty);
+ _cleanup_free_ char *path = NULL;
+ path = path_join("/dev", tty);
+ if (!path)
+ return -ENOMEM;
- *ret = TAKE_PTR(active);
+ *ret = TAKE_PTR(path);
return 0;
}
assert(tty);
- tty = skip_dev_prefix(tty);
-
- if (streq(tty, "console")) {
+ if (streq(skip_dev_prefix(tty), "console")) {
if (resolve_dev_console(&resolved) < 0)
return false;
return true; /* if we could not resolve, assume it may */
/* "tty0" means the active VC, so it may be the same sometimes */
- return path_equal(resolved, tty) || (streq(resolved, "tty0") && tty_is_vc(tty));
+ return path_equal(skip_dev_prefix(resolved), tty) || (streq(skip_dev_prefix(resolved), "tty0") && tty_is_vc(tty));
}
static bool exec_context_may_touch_tty(const ExecContext *ec) {