mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 03:05:06 -05:00
sys_generic: use privops for settimeofday()
This is needed on FreeBSD and Solaris when running without root privileges.
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
#include "local.h"
|
#include "local.h"
|
||||||
#include "localp.h"
|
#include "localp.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
#include "privops.h"
|
||||||
#include "sched.h"
|
#include "sched.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@@ -329,7 +330,7 @@ apply_step_offset(double offset)
|
|||||||
LCL_ReadRawTime(&old_time);
|
LCL_ReadRawTime(&old_time);
|
||||||
UTI_AddDoubleToTimeval(&old_time, -offset, &new_time);
|
UTI_AddDoubleToTimeval(&old_time, -offset, &new_time);
|
||||||
|
|
||||||
if (settimeofday(&new_time, NULL) < 0) {
|
if (PRV_SetTime(&new_time, NULL) < 0) {
|
||||||
DEBUG_LOG(LOGF_SysGeneric, "settimeofday() failed");
|
DEBUG_LOG(LOGF_SysGeneric, "settimeofday() failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user