mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 02:25:07 -05:00
sys_linux: report if CAP_SYS_TIME is not present
Instead of having adjtimex just fail with a permission issue improve the error messaging by warning for the lack of CAP_SYS_TIME on SYS_Linux_Initialise. Message will look like (instead of only the latter message): CAP_SYS_TIME not present adjtimex(0x8001) failed : Operation not permitted Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
This commit is contained in:
committed by
Miroslav Lichvar
parent
aa4228bf1b
commit
02098ed830
14
sys_linux.c
14
sys_linux.c
@@ -380,6 +380,18 @@ test_step_offset(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
|
static void
|
||||||
|
report_time_adjust_blockers(void)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_PRIVDROP
|
||||||
|
if (CAP_IS_SUPPORTED(CAP_SYS_TIME) && cap_get_bound(CAP_SYS_TIME))
|
||||||
|
return;
|
||||||
|
LOG(LOGS_WARN, "CAP_SYS_TIME not present");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
/* Initialisation code for this module */
|
/* Initialisation code for this module */
|
||||||
|
|
||||||
@@ -388,6 +400,8 @@ SYS_Linux_Initialise(void)
|
|||||||
{
|
{
|
||||||
get_version_specific_details();
|
get_version_specific_details();
|
||||||
|
|
||||||
|
report_time_adjust_blockers();
|
||||||
|
|
||||||
reset_adjtime_offset();
|
reset_adjtime_offset();
|
||||||
|
|
||||||
if (have_setoffset && !test_step_offset()) {
|
if (have_setoffset && !test_step_offset()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user