aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-uds.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-08-29 08:22:09 -0600
committerTom Tromey <tromey@adacore.com>2023-11-27 12:55:14 -0700
commit0da23004a064e7149373b484fa671f2a2105ec9b (patch)
treecd41c9b455ae17a9ab41b8b14a423efc94053204 /gdb/ser-uds.c
parentd69939bded50d76179f97284df35879a385cf8c0 (diff)
downloadgdb-0da23004a064e7149373b484fa671f2a2105ec9b.zip
gdb-0da23004a064e7149373b484fa671f2a2105ec9b.tar.gz
gdb-0da23004a064e7149373b484fa671f2a2105ec9b.tar.bz2
Change serial_readchar to throw
This changes serial_readchar to throw an exception rather than trying to set and preserve errno. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30770
Diffstat (limited to 'gdb/ser-uds.c')
-rw-r--r--gdb/ser-uds.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/ser-uds.c b/gdb/ser-uds.c
index baa660b..ad1f79e 100644
--- a/gdb/ser-uds.c
+++ b/gdb/ser-uds.c
@@ -69,7 +69,10 @@ uds_close (struct serial *scb)
static int
uds_read_prim (struct serial *scb, size_t count)
{
- return recv (scb->fd, scb->buf, count, 0);
+ int result = recv (scb->fd, scb->buf, count, 0);
+ if (result == -1 && errno != EINTR)
+ perror_with_name ("error while reading");
+ return result;
}
static int