diff --git a/src/libcrun/container.c b/src/libcrun/container.c index b9f2afd010..d400428b57 100644 --- a/src/libcrun/container.c +++ b/src/libcrun/container.c @@ -48,6 +48,8 @@ #include #include #include +#include +#include #include #include @@ -1980,6 +1982,7 @@ wait_for_process (struct wait_for_process_args *args, libcrun_error_t *err) while (1) { struct signalfd_siginfo si; + struct winsize ws; ssize_t res; struct epoll_event events[10]; int i, nr_events; @@ -2039,6 +2042,19 @@ wait_for_process (struct wait_for_process_args *args, libcrun_error_t *err) if (last_process) return container_exit_code; } + else if (si.ssi_signo == SIGWINCH) + { + if (UNLIKELY (args->terminal_fd < 0)) + return 0; + + ret = ioctl (0, TIOCGWINSZ, &ws); + if (UNLIKELY (ret < 0)) + return crun_error_wrap (err, "copy terminal size from stdin"); + + ret = ioctl (args->terminal_fd, TIOCSWINSZ, &ws); + if (UNLIKELY (ret < 0)) + return crun_error_wrap (err, "copy terminal size to pty"); + } else { /* Send any other signal to the child process. */