From 2a03a05a496d498857e93a70baa020154249cef6 Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Fri, 13 May 2016 20:41:39 +0200 Subject: [PATCH] Treat EOF on stdin as error --- src/tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tty.c b/src/tty.c index 7618666..945453b 100644 --- a/src/tty.c +++ b/src/tty.c @@ -79,7 +79,7 @@ void wait_for_tty_device(void) /* Read one character */ status = read(STDIN_FILENO, &c_stdin[0], 1); - if (status < 0) + if (status <= 0) { error_printf("Could not read from stdin"); exit(EXIT_FAILURE); @@ -266,7 +266,7 @@ int connect_tty(void) { /* Input from stdin ready */ status = read(STDIN_FILENO, &c_stdin[0], 1); - if (status < 0) + if (status <= 0) { error_printf("Could not read from stdin"); goto error_read;