diff --git a/src/libcrun/container.c b/src/libcrun/container.c index 5522021335..eb73c67541 100644 --- a/src/libcrun/container.c +++ b/src/libcrun/container.c @@ -2590,7 +2590,7 @@ libcrun_container_run_internal (libcrun_container_t *container, libcrun_context_ close_and_reset (&socket_pair_0); - ret = libcrun_setup_terminal_ptmx (terminal_fd, &orig_terminal, err); + ret = libcrun_set_raw (0, &orig_terminal, err); if (UNLIKELY (ret < 0)) goto fail; } @@ -3685,7 +3685,7 @@ libcrun_container_exec_with_options (libcrun_context_t *context, const char *id, } else { - ret = libcrun_setup_terminal_ptmx (terminal_fd, &orig_terminal, err); + ret = libcrun_set_raw (0, &orig_terminal, err); if (UNLIKELY (ret < 0)) { flush_fd_to_err (context, terminal_fd); diff --git a/src/libcrun/terminal.c b/src/libcrun/terminal.c index 0489b17481..4f01276d69 100644 --- a/src/libcrun/terminal.c +++ b/src/libcrun/terminal.c @@ -61,8 +61,8 @@ libcrun_new_terminal (char **pty, libcrun_error_t *err) return ret; } -static int -set_raw (int fd, void **current_status, libcrun_error_t *err) +int +libcrun_set_raw (int fd, void **current_status, libcrun_error_t *err) { int ret; struct termios termios; @@ -114,23 +114,6 @@ libcrun_set_stdio (char *pty, libcrun_error_t *err) return 0; } -int -libcrun_setup_terminal_ptmx (int fd, void **current_status, libcrun_error_t *err) -{ - int ret; - struct termios termios; - - ret = tcgetattr (fd, &termios); - if (UNLIKELY (ret < 0)) - return crun_make_error (err, errno, "tcgetattr"); - - ret = tcsetattr (fd, TCSANOW, &termios); - if (UNLIKELY (ret < 0)) - return crun_make_error (err, errno, "tcsetattr"); - - return set_raw (0, current_status, err); -} - void cleanup_terminalp (void *p) { diff --git a/src/libcrun/terminal.h b/src/libcrun/terminal.h index 27da55403c..fcd58ed87b 100644 --- a/src/libcrun/terminal.h +++ b/src/libcrun/terminal.h @@ -29,7 +29,7 @@ int libcrun_new_terminal (char **pty, libcrun_error_t *err); int libcrun_set_stdio (char *pty, libcrun_error_t *err); -int libcrun_setup_terminal_ptmx (int fd, void **current_status, libcrun_error_t *err); +int libcrun_set_raw (int fd, void **current_status, libcrun_error_t *err); int libcrun_terminal_setup_size (int fd, unsigned short rows, unsigned short cols, libcrun_error_t *err);