All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] hwclock: Check drift value in /etc/adjtime
@ 2014-05-05 18:49 Stanislav Brabec
  0 siblings, 0 replies; only message in thread
From: Stanislav Brabec @ 2014-05-05 18:49 UTC (permalink / raw)
  To: util-linux

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@suse.cz>
---
 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@suse.cz
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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-05 18:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-05 18:49 [PATCH 2/2] hwclock: Check drift value in /etc/adjtime Stanislav Brabec

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.