1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 19:21:53 +03:00

login: assing /dev/console logins to seat0

This commit is contained in:
Lennart Poettering 2012-04-22 02:30:13 +02:00
parent 337eebb936
commit d1122ad5e3
3 changed files with 21 additions and 2 deletions

View File

@ -351,16 +351,25 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
vtnr = (uint32_t) v;
else if (vtnr != (uint32_t) v)
return -EINVAL;
} else if (tty_is_console(tty)) {
if (!s)
s = m->vtconsole;
else if (s != m->vtconsole)
return -EINVAL;
if (vtnr != 0)
return -EINVAL;
} else if (!isempty(tty) && s && seat_is_vtconsole(s))
return -EINVAL;
if (s) {
if (seat_can_multi_session(s)) {
if (vtnr <= 0 || vtnr > 63)
if (vtnr > 63)
return -EINVAL;
} else {
if (vtnr > 0)
if (vtnr != 0)
return -EINVAL;
}
}

View File

@ -4287,6 +4287,15 @@ bool tty_is_vc(const char *tty) {
return vtnr_from_tty(tty) >= 0;
}
bool tty_is_console(const char *tty) {
assert(tty);
if (startswith(tty, "/dev/"))
tty += 5;
return streq(tty, "console");
}
int vtnr_from_tty(const char *tty) {
int i, r;

View File

@ -415,6 +415,7 @@ char *fstab_node_to_udev_node(const char *p);
bool tty_is_vc(const char *tty);
bool tty_is_vc_resolve(const char *tty);
bool tty_is_console(const char *tty);
int vtnr_from_tty(const char *tty);
const char *default_term_for_tty(const char *tty);