aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-tcp.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-tcp.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-tcp.c')
-rw-r--r--gdb/ser-tcp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index ce3c618..cfd1343 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -409,7 +409,10 @@ net_read_prim (struct serial *scb, size_t count)
/* Need to cast to silence -Wpointer-sign on MinGW, as Winsock's
'recv' takes 'char *' as second argument, while 'scb->buf' is
'unsigned char *'. */
- return recv (scb->fd, (char *) scb->buf, count, 0);
+ int result = recv (scb->fd, (char *) scb->buf, count, 0);
+ if (result == -1 && errno != EINTR)
+ perror_with_name ("error while reading");
+ return result;
}
int