mirror of
https://github.com/systemd/systemd.git
synced 2024-11-06 16:59:03 +03:00
login: give session ownership of VT
The tty associated with a VT should be owned by the owner of the session running on the VT. This is important for supporting a socket activated X server, since the X server will open the tty itself. This commit makes sure to chown the tty any time a session is created and and chown it back to root any time the session is removed. This behavior is copied from /bin/login.
This commit is contained in:
parent
26e376bfe3
commit
d6176c6c97
Notes:
Lennart Poettering
2014-05-24 11:17:12 +08:00
Backport: bugfix
@ -972,6 +972,10 @@ void session_mute_vt(Session *s) {
|
|||||||
if (vt < 0)
|
if (vt < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
r = fchown(vt, s->user->uid, -1);
|
||||||
|
if (r < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
r = ioctl(vt, KDSKBMODE, K_OFF);
|
r = ioctl(vt, KDSKBMODE, K_OFF);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -1026,6 +1030,8 @@ void session_restore_vt(Session *s) {
|
|||||||
mode.mode = VT_AUTO;
|
mode.mode = VT_AUTO;
|
||||||
ioctl(vt, VT_SETMODE, &mode);
|
ioctl(vt, VT_SETMODE, &mode);
|
||||||
|
|
||||||
|
fchown(vt, 0, -1);
|
||||||
|
|
||||||
s->vtfd = safe_close(s->vtfd);
|
s->vtfd = safe_close(s->vtfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user