aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2010-04-20 06:06:38 +0000
committerDoug Evans <dje@google.com>2010-04-20 06:06:38 +0000
commit9f117f472395074ea657a89049faf2cbb250538f (patch)
tree9c456c3ae63a3a769310a537c114e56d9fc1a844
parentff9f22f1a739cacfec1ab2be3a51ddeccb9fd9c4 (diff)
downloadgdb-9f117f472395074ea657a89049faf2cbb250538f.zip
gdb-9f117f472395074ea657a89049faf2cbb250538f.tar.gz
gdb-9f117f472395074ea657a89049faf2cbb250538f.tar.bz2
(generic_readchar): Tweak previous checkin, close error_fd if EOF.
-rw-r--r--gdb/ser-base.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 7afd1ee..6285342 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -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