diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-07-04 18:07:16 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-07-04 18:07:16 +0000 |
commit | 300b760e9b2462bf3922b313fdcf22d123a5a903 (patch) | |
tree | da287f9e5d0b0a9cff45c3384f18aac41487e0f8 /usr.sbin/ntpd | |
parent | ae257de739c6c48c298c0b9b21a086c9fc0e6774 (diff) |
KNF
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r-- | usr.sbin/ntpd/server.c | 18 | ||||
-rw-r--r-- | usr.sbin/ntpd/util.c | 15 |
2 files changed, 12 insertions, 21 deletions
diff --git a/usr.sbin/ntpd/server.c b/usr.sbin/ntpd/server.c index 2014a5119d3..8d9971df4f9 100644 --- a/usr.sbin/ntpd/server.c +++ b/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 <henning@openbsd.org> @@ -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/usr.sbin/ntpd/util.c b/usr.sbin/ntpd/util.c index f80d71b4e89..d16c0c7602d 100644 --- a/usr.sbin/ntpd/util.c +++ b/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 <alexander.guy@andern.org> @@ -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); |