git: 3737a0cdcb42 - stable/13 - bhyve: Fix getaddrinfo() error handling
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Jan 2023 19:25:48 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3737a0cdcb42f4495438997d4ff1655273c3016b commit 3737a0cdcb42f4495438997d4ff1655273c3016b Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-02-08 17:34:03 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-01-26 19:21:32 +0000 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 (cherry picked from commit 927aa5fefd4c69e72d44189a04fadf80e42d0ad8) --- usr.sbin/bhyve/gdb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c index 94167053629e..81f132e17350 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);