diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2019-01-20 16:40:43 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2019-01-20 16:40:43 +0000 |
commit | bc1559006e2647066546aa2dda4415e7d01c50f6 (patch) | |
tree | a52afc15e969939dcd625ee8c901b20479906f69 /usr.sbin/ntpd | |
parent | 07c3612ddec9115d1d8945ce6be9b06d2bf39fce (diff) |
Don't use *a - *b as compare idiom, it does not work as expected for
anything larger than an int. ok jca@ rsadowski@
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r-- | usr.sbin/ntpd/constraint.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ntpd/constraint.c b/usr.sbin/ntpd/constraint.c index 76dc4f7bdf5..3c48c6c902b 100644 --- a/usr.sbin/ntpd/constraint.c +++ b/usr.sbin/ntpd/constraint.c @@ -1,4 +1,4 @@ -/* $OpenBSD: constraint.c,v 1.38 2018/11/29 14:25:07 tedu Exp $ */ +/* $OpenBSD: constraint.c,v 1.39 2019/01/20 16:40:42 otto Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -757,7 +757,9 @@ constraint_msg_dns(u_int32_t id, u_int8_t *data, size_t len) int constraint_cmp(const void *a, const void *b) { - return (*(const time_t *)a - *(const time_t *)b); + time_t at = *(const time_t *)a; + time_t bt = *(const time_t *)b; + return at < bt ? -1 : (at > bt ? 1 : 0); } void |