if (!num)
return -EINVAL;
- if (num >= s->position_count || !s->positions[num])
+ if (num >= s->position_count || !s->positions[num]) {
+ /* allow switching to unused VTs to trigger auto-activate */
+ if (seat_has_vts(s) && num < 64)
+ return chvt(num);
+
return -EINVAL;
+ }
return session_activate(s->positions[num]);
}
if (seat_has_vts(s))
pos = session->vtnr;
- if (!GREEDY_REALLOC0_T(s->positions, s->position_count, pos + 1))
+ if (!GREEDY_REALLOC0(s->positions, s->position_count, pos + 1))
return;
seat_evict_position(s, session);