@@ -233,7 +233,7 @@ int ask_string(char **ret, const char *text, ...) {
233233
234234int reset_terminal_fd (int fd , bool switch_to_text ) {
235235 struct termios termios ;
236- int r = 0 ;
236+ int r ;
237237
238238 /* Set terminal to some sane defaults */
239239
@@ -256,7 +256,9 @@ int reset_terminal_fd(int fd, bool switch_to_text) {
256256
257257
258258 /* Set default keyboard mode */
259- (void ) vt_reset_keyboard (fd );
259+ r = vt_reset_keyboard (fd );
260+ if (r < 0 )
261+ log_debug_errno (r , "Failed to reset VT keyboard, ignoring: %m" );
260262
261263 if (tcgetattr (fd , & termios ) < 0 ) {
262264 r = log_debug_errno (errno , "Failed to get terminal parameters: %m" );
@@ -271,7 +273,7 @@ int reset_terminal_fd(int fd, bool switch_to_text) {
271273 termios .c_iflag |= ICRNL | IMAXBEL | IUTF8 ;
272274 termios .c_oflag |= ONLCR | OPOST ;
273275 termios .c_cflag |= CREAD ;
274- termios .c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOPRT | ECHOKE ;
276+ termios .c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE ;
275277
276278 termios .c_cc [VINTR ] = 03 ; /* ^C */
277279 termios .c_cc [VQUIT ] = 034 ; /* ^\ */
@@ -290,8 +292,7 @@ int reset_terminal_fd(int fd, bool switch_to_text) {
290292 termios .c_cc [VTIME ] = 0 ;
291293 termios .c_cc [VMIN ] = 1 ;
292294
293- if (tcsetattr (fd , TCSANOW , & termios ) < 0 )
294- r = - errno ;
295+ r = RET_NERRNO (tcsetattr (fd , TCSANOW , & termios ));
295296
296297finish :
297298 /* Just in case, flush all crap out */
0 commit comments