Normalize adjtime() parameter. ok cheloha@, kn@, naddy@.

This commit is contained in:
matthieu 2020-09-27 14:48:17 +00:00
parent bbbcd18760
commit ba415e6526
2 changed files with 20 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.80 2020/03/20 16:44:26 naddy Exp $
# $OpenBSD: Makefile,v 1.81 2020/09/27 14:48:17 matthieu Exp $
COMMENT= Network Time Protocol reference implementation
@ -7,7 +7,7 @@ COMMENT= Network Time Protocol reference implementation
# 'pl' for local use.
VERSION= 4.2.8p10
REVISION= 5
REVISION= 6
DISTNAME= ntp-${VERSION}
PKGNAME= ntp-${VERSION:S/p/pl/}
CATEGORIES= net

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-libntp_systime_c,v 1.1 2020/09/27 14:48:17 matthieu Exp $
Normalize adjtime() argument.
Index: libntp/systime.c
--- libntp/systime.c.orig
+++ libntp/systime.c
@@ -346,6 +346,10 @@ adj_systime(
adjtv.tv_usec = -adjtv.tv_usec;
sys_residual = -sys_residual;
}
+ while (adjtv.tv_usec < 0) {
+ adjtv.tv_usec += 1000000;
+ adjtv.tv_sec -= 1;
+ }
if (adjtv.tv_sec != 0 || adjtv.tv_usec != 0) {
if (adjtime(&adjtv, &oadjtv) < 0) {
msyslog(LOG_ERR, "adj_systime: %m");