return 0;
}
-void session_mute_vt(Session *s) {
+void session_prepare_vt(Session *s) {
int vt, r;
struct vt_mode mode = { 0 };
sigset_t mask;
if (vt < 0)
return;
+ r = fchown(vt, s->user->uid, -1);
+ if (r < 0)
+ goto error;
+
r = ioctl(vt, KDSKBMODE, K_OFF);
if (r < 0)
goto error;
mode.mode = VT_AUTO;
ioctl(vt, VT_SETMODE, &mode);
+ fchown(vt, 0, -1);
+
s->vtfd = safe_close(s->vtfd);
}
* exits.
* If logind crashes/restarts, we restore the controller during restart
* or reset the VT in case it crashed/exited, too. */
- session_mute_vt(s);
+ session_prepare_vt(s);
return 0;
}