diff options
author | Tom Tromey <tromey@adacore.com> | 2023-08-29 08:22:09 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-11-27 12:55:14 -0700 |
commit | 0da23004a064e7149373b484fa671f2a2105ec9b (patch) | |
tree | cd41c9b455ae17a9ab41b8b14a423efc94053204 /gdb/ser-tcp.c | |
parent | d69939bded50d76179f97284df35879a385cf8c0 (diff) | |
download | gdb-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.c | 5 |
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 |