summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/libntp/systime.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/libntp/systime.c')
-rw-r--r--contrib/ntp/libntp/systime.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/contrib/ntp/libntp/systime.c b/contrib/ntp/libntp/systime.c
index f5eabcd..c89d157 100644
--- a/contrib/ntp/libntp/systime.c
+++ b/contrib/ntp/libntp/systime.c
@@ -25,6 +25,8 @@
# include <utmpx.h>
#endif /* HAVE_UTMPX_H */
+int allow_panic = FALSE; /* allow panic correction (-g) */
+int enable_panic_check = TRUE; /* Can we check allow_panic's state? */
#ifndef USE_COMPILETIME_PIVOT
# define USE_COMPILETIME_PIVOT 1
@@ -295,8 +297,13 @@ adj_systime(
* EVNT_NSET adjtime() can be aborted by a tiny adjtime()
* triggered by sys_residual.
*/
- if (0. == now)
+ if (0. == now) {
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "adj_systime: allow_panic is TRUE!");
+ INSIST(!allow_panic);
+ }
return TRUE;
+ }
/*
* Most Unix adjtime() implementations adjust the system clock
@@ -333,9 +340,15 @@ adj_systime(
if (adjtv.tv_sec != 0 || adjtv.tv_usec != 0) {
if (adjtime(&adjtv, &oadjtv) < 0) {
msyslog(LOG_ERR, "adj_systime: %m");
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "adj_systime: allow_panic is TRUE!");
+ }
return FALSE;
}
}
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "adj_systime: allow_panic is TRUE!");
+ }
return TRUE;
}
#endif
@@ -419,6 +432,9 @@ step_systime(
/* now set new system time */
if (ntp_set_tod(&timetv, NULL) != 0) {
msyslog(LOG_ERR, "step-systime: %m");
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "step_systime: allow_panic is TRUE!");
+ }
return FALSE;
}
@@ -445,7 +461,7 @@ step_systime(
* long ut_time;
* };
* and appends line="|", name="date", host="", time for the OLD
- * and appends line="{", name="date", host="", time for the NEW
+ * and appends line="{", name="date", host="", time for the NEW // }
* to _PATH_WTMP .
*
* Some OSes have utmp, some have utmpx.
@@ -564,6 +580,10 @@ step_systime(
#endif /* UPDATE_WTMPX */
}
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "step_systime: allow_panic is TRUE!");
+ INSIST(!allow_panic);
+ }
return TRUE;
}
OpenPOWER on IntegriCloud