]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
terminal-util: turn off echo on stdin, not stdout
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Jul 2024 14:32:22 +0000 (16:32 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 19 Jul 2024 09:41:43 +0000 (11:41 +0200)
This doesn't make much of a different IRL, but it feels more right that
an operation that happens in input is turned off via the input fd.

src/basic/terminal-util.c

index ad22599553252e8204a1a029128df84267ead8ce..5ebb7e0a74bc9d28068c896c5961f65e831df3b9 100644 (file)
@@ -1752,7 +1752,7 @@ int get_default_background_color(double *ret_red, double *ret_green, double *ret
         struct termios new_termios = old_termios;
         termios_disable_echo(&new_termios);
 
-        if (tcsetattr(STDOUT_FILENO, TCSADRAIN, &new_termios) < 0)
+        if (tcsetattr(STDIN_FILENO, TCSADRAIN, &new_termios) < 0)
                 return -errno;
 
         r = loop_write(STDOUT_FILENO, "\x1B]11;?\x07", SIZE_MAX);
@@ -1813,6 +1813,6 @@ int get_default_background_color(double *ret_red, double *ret_green, double *ret
         }
 
 finish:
-        (void) tcsetattr(STDOUT_FILENO, TCSADRAIN, &old_termios);
+        (void) tcsetattr(STDIN_FILENO, TCSADRAIN, &old_termios);
         return r;
 }