and make sure errno is reset before read()
Signed-off-by: Karel Zak <kzak@redhat.com>
cp->eol = *ptr = '\0';
eightbit = ((con->flags & CON_SERIAL) == 0 || (tty.c_cflag & (PARODD|PARENB)) == 0);
+
while (cp->eol == '\0') {
+ errno = 0;
+
if (read(fd, &c, 1) < 1) {
if (errno == EINTR || errno == EAGAIN) {
if (alarm_rised) {
continue;
}
ret = NULL;
+
switch (errno) {
case EIO:
con->flags |= CON_EIO;
+ /* fallthrough */
default:
warn(_("cannot read %s"), con->tty);
break;