diff --git a/src/usr.sbin/ntpd/server.c b/src/usr.sbin/ntpd/server.c index 2014a511..8d9971df 100644 --- a/src/usr.sbin/ntpd/server.c +++ b/src/usr.sbin/ntpd/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.3 2004/06/29 18:34:00 alexander Exp $ */ +/* $OpenBSD: server.c,v 1.4 2004/07/04 18:07:15 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -30,7 +30,7 @@ int setup_listeners(struct servent *se, struct ntpd_conf *conf, u_int *cnt) { - char ntopbuf[INET6_ADDRSTRLEN]; + char ntopbuf[INET6_ADDRSTRLEN]; struct listen_addr *la; struct ifaddrs *ifap; struct sockaddr *sap; @@ -64,29 +64,23 @@ setup_listeners(struct servent *se, struct ntpd_conf *conf, u_int *cnt) switch (la->sa.ss_family) { case AF_INET: - if (((struct sockaddr_in *)sap)->sin_port == 0) ((struct sockaddr_in *)sap)->sin_port = se->s_port; - inet_ntop(AF_INET, - &((struct sockaddr_in *)sap)->sin_addr, - ntopbuf, sizeof(ntopbuf)); - + &((struct sockaddr_in *)sap)->sin_addr, + ntopbuf, sizeof(ntopbuf)); break; case AF_INET6: - if (((struct sockaddr_in6 *)sap)->sin6_port == 0) ((struct sockaddr_in6 *)sap)->sin6_port = se->s_port; - inet_ntop(AF_INET6, - &((struct sockaddr_in6 *)sap)->sin6_addr, - ntopbuf, sizeof(ntopbuf)); + &((struct sockaddr_in6 *)sap)->sin6_addr, + ntopbuf, sizeof(ntopbuf)); break; default: fatalx("king bula sez: af borked"); - } log_debug("adding listener on %s", ntopbuf); diff --git a/src/usr.sbin/ntpd/util.c b/src/usr.sbin/ntpd/util.c index f80d71b4..d16c0c76 100644 --- a/src/usr.sbin/ntpd/util.c +++ b/src/usr.sbin/ntpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.1 2004/07/04 11:01:49 alexander Exp $ */ +/* $OpenBSD: util.c,v 1.2 2004/07/04 18:07:15 henning Exp $ */ /* * Copyright (c) 2004 Alexander Guy @@ -23,21 +23,18 @@ double gettime(void) { - struct timeval tv; - double ret; + struct timeval tv; if (gettimeofday(&tv, NULL) == -1) fatal("gettimeofday"); - ret = tv.tv_sec + JAN_1970 + 1.0e-6 * tv.tv_usec; - - return (ret); + return (tv.tv_sec + JAN_1970 + 1.0e-6 * tv.tv_usec); } double lfp_to_d(struct l_fixedpt lfp) { - double ret; + double ret; lfp.int_part = ntohl(lfp.int_part); lfp.fraction = ntohl(lfp.fraction); @@ -50,8 +47,8 @@ lfp_to_d(struct l_fixedpt lfp) struct l_fixedpt d_to_lfp(double d) { - struct l_fixedpt lfp; - + struct l_fixedpt lfp; + lfp.int_part = htonl(d); lfp.fraction = htonl((d - lfp.int_part) * UINT_MAX);