summaryrefslogtreecommitdiff
path: root/src/login/logind-session.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/login/logind-session.c')
-rw-r--r--src/login/logind-session.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index b4fd349f00..83c0ffa65c 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -972,6 +972,10 @@ void session_mute_vt(Session *s) {
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;
@@ -1026,6 +1030,8 @@ void session_restore_vt(Session *s) {
mode.mode = VT_AUTO;
ioctl(vt, VT_SETMODE, &mode);
+ fchown(vt, 0, -1);
+
s->vtfd = safe_close(s->vtfd);
}