The branch main has been updated by vangyzen:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=576313b983dca243d7ba6af8b57517bed419ecb4

commit 576313b983dca243d7ba6af8b57517bed419ecb4
Author:     Eric van Gyzen <[email protected]>
AuthorDate: 2021-03-05 16:39:53 +0000
Commit:     Eric van Gyzen <[email protected]>
CommitDate: 2021-03-07 23:23:04 +0000

    dumpon: do not print errno for resolver failure
    
    When the netdump host name fails to resolve, don't print errno, since
    it's irrelevant.  We might as well use a different exit status, too.
    
    Sponsored by:   Dell EMC Isilon
---
 sbin/dumpon/dumpon.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c
index 2b710a611af3..183ce5f08cb3 100644
--- a/sbin/dumpon/dumpon.c
+++ b/sbin/dumpon/dumpon.c
@@ -532,10 +532,11 @@ main(int argc, char *argv[])
                hints.ai_protocol = IPPROTO_UDP;
                res = NULL;
                error = getaddrinfo(server, NULL, &hints, &res);
-               if (error != 0)
-                       err(1, "%s", gai_strerror(error));
-               if (res == NULL)
-                       errx(1, "failed to resolve '%s'", server);
+               if (error != 0) {
+                       if (error == EAI_SYSTEM)
+                               err(EX_OSERR, "%s", gai_strerror(error));
+                       errx(EX_NOHOST, "%s", gai_strerror(error));
+               }
                server = inet_ntoa(
                    ((struct sockaddr_in *)(void *)res->ai_addr)->sin_addr);
                freeaddrinfo(res);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to