getty: do not emit bogus error message on EOF

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-05-22 21:17:46 +02:00
parent fef9ee7072
commit 765b0eed3e

View File

@ -431,6 +431,7 @@ static char *get_logname(char *logname, unsigned size_logname,
while (cp->eol == '\0') { while (cp->eol == '\0') {
/* Do not report trivial EINTR/EIO errors. */ /* Do not report trivial EINTR/EIO errors. */
errno = EINTR; /* make read of 0 bytes be silent too */
if (read(STDIN_FILENO, &c, 1) < 1) { if (read(STDIN_FILENO, &c, 1) < 1) {
if (errno == EINTR || errno == EIO) if (errno == EINTR || errno == EIO)
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);