[PATCH 2/2] hwclock: Check drift value in /etc/adjtime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to bug in older versions of hwclock, /etc/adjtime can contain
excessive drift value (up to many years per day). Prevent it
from applying.

Signed-off-by: Stanislav Brabec <sbrabec@xxxxxxx>
---
 sys-utils/hwclock.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 5e786a8..fe97fcb 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -1211,6 +1211,10 @@ do_adjustment(struct adjtime *adjtime_p,
 			printf(_
 			       ("Not setting clock because last adjustment time is zero, "
 				"so history is bad."));
+	} else if (abs(adjtime_p->drift_factor) > MAX_DRIFT) {
+		if (debug)
+		printf(_("Not setting clock because drift factor %f is far too high.\n"),
+		       adjtime_p->drift_factor);
 	} else {
 		int adjustment;
 		/* Number of seconds we must insert in the Hardware Clock */
-- 
1.8.4.5

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@xxxxxxx
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                 fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux