diff options
author | Franck Bui <fbui@suse.com> | 2018-08-27 22:33:44 +0200 |
---|---|---|
committer | Franck Bui <fbui@suse.com> | 2018-11-21 14:25:10 +0100 |
commit | 6179ede1c55c0b7b31b8f71e17d68ec2318ef2d5 (patch) | |
tree | c9bc95194217b27a707e8fe40170e2a4e87d4b7d /src/login/logind-session.c | |
parent | 0212126c4515553444dc250f39ffd65c038b2c87 (diff) | |
download | systemd-6179ede1c55c0b7b31b8f71e17d68ec2318ef2d5.tar.gz |
terminal-util: introduce vt_restore() helper
Diffstat (limited to 'src/login/logind-session.c')
-rw-r--r-- | src/login/logind-session.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c index b77431b449..adbd8008fa 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -1225,12 +1225,7 @@ error: } static void session_restore_vt(Session *s) { - - static const struct vt_mode mode = { - .mode = VT_AUTO, - }; - - int vt, old_fd; + int r, vt, old_fd; /* We need to get a fresh handle to the virtual terminal, * since the old file-descriptor is potentially in a hung-up @@ -1246,12 +1241,9 @@ static void session_restore_vt(Session *s) { if (vt < 0) return; - (void) ioctl(vt, KDSETMODE, KD_TEXT); - - (void) vt_reset_keyboard(vt); - - (void) ioctl(vt, VT_SETMODE, &mode); - (void) fchown(vt, 0, (gid_t) -1); + r = vt_restore(vt); + if (r < 0) + log_warning_errno(r, "Failed to restore VT, ignoring: %m"); s->vtfd = safe_close(s->vtfd); } |