]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Some fixes to make ntpdate work on SunOS4.
authorJohn Hay <hay@ntp.org>
Mon, 22 Jul 2002 16:45:54 +0000 (18:45 +0200)
committerJohn Hay <hay@ntp.org>
Mon, 22 Jul 2002 16:45:54 +0000 (18:45 +0200)
bk: 3d3c36c2OH0z6B8GhhOrEOlE5NL_Sw

libntp/ntp_rfc2553.c
ntpdate/ntpdate.c

index 0d8693a1930ff32ee8e661b6a5c42b9028bc445b..df90dea8fc907da21a163c02f0b0a84651658cc6 100644 (file)
@@ -85,8 +85,6 @@
 
 #ifndef HAVE_IPV6
 
-#define        LOCALHOST       0x7f000001      /* 127.0.0.1, in hex, of course */
-
 #if 0
 /* XXX This is the preferred way, but for some reason the SunOS compiler
  * does not like it.
@@ -171,9 +169,10 @@ getaddrinfo (const char *nodename, const char *servname,
                ai->ai_family = AF_INET;
                ai->ai_addrlen = sizeof(struct sockaddr_storage);
                sockin = (struct sockaddr_in *)ai->ai_addr;
-               sockin->sin_addr.s_addr = htonl(LOCALHOST);
+               sockin->sin_family = AF_INET;
+               sockin->sin_addr.s_addr = htonl(INADDR_ANY);
 #ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
-               ai->ai_addr->sa_len = sizeof(struct sockaddr);
+               ai->ai_addr->sa_len = SOCKLEN(ai->ai_addr);
 #endif
        }
        if (servname != NULL) {
index 0b4d9bfea128fa3806ed3c5714bb3565e4658900..3c9137f30b20ad55b9736ae3071a11685609f289 100644 (file)
@@ -1715,7 +1715,7 @@ init_io(void)
         * bind the socket to the NTP port
         */
        if (!debug && !simple_query && !unpriv_port) {
-                   if (bind(fd[nbsock], res->ai_addr, res->ai_addrlen) < 0) {
+               if (bind(fd[nbsock], res->ai_addr, SOCKLEN(res->ai_addr)) < 0) {
 #ifndef SYS_WINNT
                        if (errno == EADDRINUSE)
 #else