From d11f8c6ba92fc28c3ea4d76676ff7d5148c36d7d Mon Sep 17 00:00:00 2001 From: Ken Hornstein Date: Wed, 17 May 2017 21:40:57 -0400 Subject: [PATCH] Apparently on Linux if a slave pty is closed, instead of the master getting an EOF they get an EIO, which strikes me as unfriendly. So make sure we exit the main read loop without complaint on an EOF or error. --- test/runpty.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/runpty.c b/test/runpty.c index a2fe6f48..e5de14e0 100644 --- a/test/runpty.c +++ b/test/runpty.c @@ -136,12 +136,7 @@ main(int argc, char *argv[]) if (cc > 0 && FD_ISSET(master, &readfds)) { cc = read(master, readbuf, sizeof(readbuf)); - if (cc < 0) { - fprintf(stderr, "read() failed: %s\n", strerror(errno)); - exit(1); - } - - if (cc == 0) + if (cc <= 0) break; fwrite(readbuf, 1, cc, output); -- 2.56.0