]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Check the error code if socket fails. Don't die if it is one of EPROTONOSUPPORT,
authorJohn Hay <hay@ntp.org>
Mon, 4 Nov 2002 17:35:10 +0000 (19:35 +0200)
committerJohn Hay <hay@ntp.org>
Mon, 4 Nov 2002 17:35:10 +0000 (19:35 +0200)
EAFNOSUPPORT or EPFNOSUPPORT. This makes it work on Linux without IPv6 in the
kernel.

bk: 3dc6afceU5EX_V6eNey_E67sX2JKjw

ntpdate/ntpdate.c

index 18f02818db783e54f090c17dc6d84dca294a5223..0385d2dcf3e24fd568d9b2d20978274835a4dd2a 100644 (file)
@@ -1676,6 +1676,9 @@ init_io(void)
         for(nbsock = 0; (nbsock < MAX_AF) && res ; res = res->ai_next) {
        /* create a datagram (UDP) socket */
            if ((fd[nbsock] = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) {
+               if (errno == EPROTONOSUPPORT || errno == EAFNOSUPPORT ||
+                   errno == EPFNOSUPPORT)
+                       continue;
                msyslog(LOG_ERR, "socket() failed: %m");
                exit(1);
                /*NOTREACHED*/