From 035b613f80000a71069440ec13b0dabae8eaba33 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 1 Jul 2019 08:34:25 +0200 Subject: [PATCH] src: don't abort on EIO when restoring tty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EIO has been observed to be returned by the Linux kernel under some circumstances. Reading through drivers/tty/tty_io*.c, it seems to indicate the tty went away. Of course none of this is documented. Fixes: https://github.com/nodejs/node/issues/28479 PR-URL: https://github.com/nodejs/node/pull/28490 Reviewed-By: Michaƫl Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Gus Caplan --- src/node.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 8faac1212be2ad..c074ed0dfe1b47 100644 --- a/src/node.cc +++ b/src/node.cc @@ -644,7 +644,10 @@ void ResetStdio() { do err = tcsetattr(fd, TCSANOW, &s.termios); while (err == -1 && errno == EINTR); // NOLINT - CHECK_NE(err, -1); + // EIO has been observed to be returned by the Linux kernel under some + // circumstances. Reading through drivers/tty/tty_io*.c, it seems to + // indicate the tty went away. Of course none of this is documented. + CHECK_IMPLIES(err == -1, errno == EIO); } } #endif // __POSIX__