mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-05 03:15:06 -05:00
sys_linux: always call TMX_SetLeap() in set_leap()
The optimization avoiding unnecessary setting of the kernel leap status can cause a problem when something outside chronyd sets the status to the new expected value. There will be no TMX_SetLeap() call which would update the saved status and the kernel status will be overwritten with the old (incorrect) value in a later TMX_*() call. Always call TMX_SetLeap() to save the new value and for the log message selection just check if a leap second has been applied.
This commit is contained in:
@@ -173,15 +173,13 @@ read_frequency(void)
|
||||
static void
|
||||
set_leap(int leap)
|
||||
{
|
||||
int current_leap, applied;
|
||||
int applied;
|
||||
|
||||
if (TMX_GetLeap(¤t_leap, &applied) < 0) {
|
||||
applied = 0;
|
||||
if (!leap && TMX_GetLeapApplied(&applied) < 0) {
|
||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed in set_leap");
|
||||
}
|
||||
|
||||
if (current_leap == leap)
|
||||
return;
|
||||
|
||||
if (TMX_SetLeap(leap) < 0) {
|
||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed in set_leap");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user