mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
Merge pull request #990 from owtaylor/issue-989
Issue 989 - logind: VT is not properly reset on session close
This commit is contained in:
commit
2c04e5c7e5
@ -986,7 +986,7 @@ static int session_open_vt(Session *s) {
|
||||
return s->vtfd;
|
||||
|
||||
sprintf(path, "/dev/tty%u", s->vtnr);
|
||||
s->vtfd = open(path, O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY);
|
||||
s->vtfd = open_terminal(path, O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY);
|
||||
if (s->vtfd < 0)
|
||||
return log_error_errno(errno, "cannot open VT %s of session %s: %m", path, s->id);
|
||||
|
||||
@ -1050,7 +1050,18 @@ void session_restore_vt(Session *s) {
|
||||
int vt, kb = K_XLATE;
|
||||
struct vt_mode mode = { 0 };
|
||||
|
||||
/* We need to get a fresh handle to the virtual terminal,
|
||||
* since the old file-descriptor is potentially in a hung-up
|
||||
* state after the controlling process exited; we do a
|
||||
* little dance to avoid having the terminal be available
|
||||
* for reuse before we've cleaned it up.
|
||||
*/
|
||||
int old_fd = s->vtfd;
|
||||
s->vtfd = -1;
|
||||
|
||||
vt = session_open_vt(s);
|
||||
safe_close(old_fd);
|
||||
|
||||
if (vt < 0)
|
||||
return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user