(generic_readchar): Tweak previous checkin, close error_fd if EOF.

This commit is contained in:
Doug Evans 2010-04-20 06:06:38 +00:00
parent ff9f22f1a7
commit 9f117f4723
1 changed files with 8 additions and 1 deletions

View File

@ -361,8 +361,15 @@ generic_readchar (struct serial *scb, int timeout,
break;
s = read (scb->error_fd, &buf, to_read);
if (s <= 0)
if (s == -1)
break;
if (s == 0)
{
/* EOF */
close (scb->error_fd);
scb->error_fd = -1;
break;
}
/* In theory, embedded newlines are not a problem.
But for MI, we want each output line to have just