diff options
author | Ray Strode <rstrode@redhat.com> | 2014-04-22 13:27:58 -0400 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-04-23 17:36:43 +0200 |
commit | d6176c6c97bf0614c2e7caaf2156bf813b39337a (patch) | |
tree | 95b846b71ccb2c19b2769cb37e89e862598fd4e9 /src/login | |
parent | 26e376bfe34ba6caa04723b9200e9deace8e6c9f (diff) |
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.
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/logind-session.c | 6 |
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); } |