Merge pull request #29 from jwilk/stdin-eof

Treat EOF on stdin as error
This commit is contained in:
Martin Lund 2016-05-13 21:15:18 +02:00
commit 315ebd7007

View file

@ -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;