summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/logind.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/logind.c b/src/logind.c
index 8507c2e152..bb64ab2859 100644
--- a/src/logind.c
+++ b/src/logind.c
@@ -683,9 +683,14 @@ int manager_spawn_autovt(Manager *m, int vtnr) {
dbus_error_init(&error);
+ if (vtnr > m->n_autovts)
+ return 0;
+
r = vt_is_busy(vtnr);
- if (r != 0)
+ if (r < 0)
return r;
+ else if (r > 0)
+ return -EBUSY;
message = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnit");
if (!message) {