diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index b505a3ad0ec..c266fea8104 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -233,7 +233,7 @@ int ask_string(char **ret, const char *text, ...) { int reset_terminal_fd(int fd, bool switch_to_text) { struct termios termios; - int r = 0; + int r; /* Set terminal to some sane defaults */ @@ -256,7 +256,9 @@ int reset_terminal_fd(int fd, bool switch_to_text) { /* Set default keyboard mode */ - (void) vt_reset_keyboard(fd); + r = vt_reset_keyboard(fd); + if (r < 0) + log_debug_errno(r, "Failed to reset VT keyboard, ignoring: %m"); if (tcgetattr(fd, &termios) < 0) { r = log_debug_errno(errno, "Failed to get terminal parameters: %m"); @@ -290,8 +292,7 @@ int reset_terminal_fd(int fd, bool switch_to_text) { termios.c_cc[VTIME] = 0; termios.c_cc[VMIN] = 1; - if (tcsetattr(fd, TCSANOW, &termios) < 0) - r = -errno; + r = RET_NERRNO(tcsetattr(fd, TCSANOW, &termios)); finish: /* Just in case, flush all crap out */