Only require privilege to set the current time adjustment, not in order to
query it.
This commit is contained in:
parent
a2346f7c3c
commit
b4be6ef22f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170732
@ -950,9 +950,6 @@ kern_adjtime(struct thread *td, struct timeval *delta, struct timeval *olddelta)
|
||||
struct timeval atv;
|
||||
int error;
|
||||
|
||||
if ((error = priv_check(td, PRIV_ADJTIME)))
|
||||
return (error);
|
||||
|
||||
mtx_lock(&Giant);
|
||||
if (olddelta) {
|
||||
atv.tv_sec = time_adjtime / 1000000;
|
||||
@ -963,10 +960,15 @@ kern_adjtime(struct thread *td, struct timeval *delta, struct timeval *olddelta)
|
||||
}
|
||||
*olddelta = atv;
|
||||
}
|
||||
if (delta)
|
||||
if (delta) {
|
||||
if ((error = priv_check(td, PRIV_ADJTIME))) {
|
||||
mtx_unlock(&Giant);
|
||||
return (error);
|
||||
}
|
||||
time_adjtime = (int64_t)delta->tv_sec * 1000000 +
|
||||
delta->tv_usec;
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
return (error);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user