]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sys_timex: set timex constant on Solaris
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 18 Sep 2015 08:16:40 +0000 (10:16 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 18 Sep 2015 14:42:40 +0000 (16:42 +0200)
The kernel apparently checks the constant even when it's not being set
with MOD_TIMECONST and may return EINVAL on an uninitialized value.

sys_timex.c

index 05afc92f556426b14e876ac1822e14c8f1b43468..b2b53994a921a96b1a74ce5db0098f71659d4595 100644 (file)
@@ -215,6 +215,12 @@ SYS_Timex_Adjust(struct timex *txc, int ignore_error)
 {
   int state;
 
+#ifdef SOLARIS
+  /* The kernel seems to check the constant even when it's not being set */
+  if (!(txc->modes & MOD_TIMECONST))
+    txc->constant = 10;
+#endif
+
   state = NTP_ADJTIME(txc);
 
   if (state < 0) {