Skip to content

Commit e208daa

Browse files
authored
Merge pull request #1683 from giuseppe/ignore-SIGWINCH-without-tty
container: ignore SIGWINCH without tty
2 parents 4d6eae2 + 459595b commit e208daa

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/libcrun/container.c

+11-10
Original file line numberDiff line numberDiff line change
@@ -2181,16 +2181,17 @@ wait_for_process (struct wait_for_process_args *args, libcrun_error_t *err)
21812181
}
21822182
else if (si.ssi_signo == SIGWINCH)
21832183
{
2184-
if (UNLIKELY (args->terminal_fd < 0))
2185-
return 0;
2186-
2187-
ret = ioctl (0, TIOCGWINSZ, &ws);
2188-
if (UNLIKELY (ret < 0))
2189-
return crun_make_error (err, errno, "copy terminal size from stdin");
2190-
2191-
ret = ioctl (args->terminal_fd, TIOCSWINSZ, &ws);
2192-
if (UNLIKELY (ret < 0))
2193-
return crun_make_error (err, errno, "copy terminal size to pty");
2184+
/* Ignore the signal if the terminal is not available. */
2185+
if (args->terminal_fd > 0)
2186+
{
2187+
ret = ioctl (0, TIOCGWINSZ, &ws);
2188+
if (UNLIKELY (ret < 0))
2189+
return crun_make_error (err, errno, "copy terminal size from stdin");
2190+
2191+
ret = ioctl (args->terminal_fd, TIOCSWINSZ, &ws);
2192+
if (UNLIKELY (ret < 0))
2193+
return crun_make_error (err, errno, "copy terminal size to pty");
2194+
}
21942195
}
21952196
else
21962197
{

0 commit comments

Comments
 (0)