[systemd-commits] 2 commits - src/util.c

Michal Schmidt michich at kemper.freedesktop.org
Thu Jan 5 16:41:38 PST 2012


 src/util.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 5c0100a53772eb7f4b11db7b071fc63e82e5a1a7
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Fri Jan 6 01:32:34 2012 +0100

    util: switch the console to text mode on reset
    
    In case we're taking over the console after a killed X server.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=771563

diff --git a/src/util.c b/src/util.c
index 1cff547..b4c5e2e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2465,6 +2465,9 @@ int reset_terminal_fd(int fd) {
         /* Disable exclusive mode, just in case */
         ioctl(fd, TIOCNXCL);
 
+        /* Switch to text mode */
+        ioctl(fd, KDSETMODE, KD_TEXT);
+
         /* Enable console unicode mode */
         ioctl(fd, KDSKBMODE, K_UNICODE);
 

commit df465b3f4419b6ba2e12bf9a5f7d7bde5a0c3531
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Fri Jan 6 01:28:30 2012 +0100

    util: fix switching to console unicode mode
    
    The KDSKBMODE ioctl wants a value directly, not its address.

diff --git a/src/util.c b/src/util.c
index 2b735e8..1cff547 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2453,7 +2453,6 @@ int ask(char *ret, const char *replies, const char *text, ...) {
 int reset_terminal_fd(int fd) {
         struct termios termios;
         int r = 0;
-        long arg;
 
         /* Set terminal to some sane defaults */
 
@@ -2467,8 +2466,7 @@ int reset_terminal_fd(int fd) {
         ioctl(fd, TIOCNXCL);
 
         /* Enable console unicode mode */
-        arg = K_UNICODE;
-        ioctl(fd, KDSKBMODE, &arg);
+        ioctl(fd, KDSKBMODE, K_UNICODE);
 
         if (tcgetattr(fd, &termios) < 0) {
                 r = -errno;



More information about the systemd-commits mailing list