aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2022-02-08 17:34:03 +0000
committerMark Johnston <markj@FreeBSD.org>2022-02-08 17:40:41 +0000
commit927aa5fefd4c69e72d44189a04fadf80e42d0ad8 (patch)
tree606bdc3ecb6bfa500bd0837ff62cb7f3fdc7e3b4
parent745f30641cc4f6c4ef9726edc2e8777cf867424e (diff)
downloadsrc-927aa5fefd4c69e72d44189a04fadf80e42d0ad8.tar.gz
src-927aa5fefd4c69e72d44189a04fadf80e42d0ad8.zip
bhyve: Fix getaddrinfo() error handling
- Use errx() since errno will not be set. - Print the message returned by gai_strerror(). MFC after: 1 week Sponsored by: The FreeBSD Foundation
-rw-r--r--usr.sbin/bhyve/gdb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c
index 0cee1c8f9543..3842a1d58dec 100644
--- a/usr.sbin/bhyve/gdb.c
+++ b/usr.sbin/bhyve/gdb.c
@@ -1858,8 +1858,9 @@ init_gdb(struct vmctx *_ctx)
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE;
- if (getaddrinfo(saddr, sport, &hints, &gdbaddr) != 0)
- err(1, "gdb address resolve");
+ error = getaddrinfo(saddr, sport, &hints, &gdbaddr);
+ if (error != 0)
+ errx(1, "gdb address resolution: %s", gai_strerror(error));
ctx = _ctx;
s = socket(gdbaddr->ai_family, gdbaddr->ai_socktype, 0);