aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_ntptime.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2007-06-14 18:37:58 +0000
committerRobert Watson <rwatson@FreeBSD.org>2007-06-14 18:37:58 +0000
commitb4be6ef22fdb72abe1a4d84721a69582a0ccbfed (patch)
tree4db8624dcaa8cff59df39a75e90774301ac6303e /sys/kern/kern_ntptime.c
parenta2346f7c3cd3ee540893b8c53f528aa875379506 (diff)
downloadsrc-b4be6ef22fdb72abe1a4d84721a69582a0ccbfed.tar.gz
src-b4be6ef22fdb72abe1a4d84721a69582a0ccbfed.zip
Only require privilege to set the current time adjustment, not in order to
query it.
Notes
Notes: svn path=/head/; revision=170732
Diffstat (limited to 'sys/kern/kern_ntptime.c')
-rw-r--r--sys/kern/kern_ntptime.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c
index b1148235fe69..30cb4b1ca701 100644
--- a/sys/kern/kern_ntptime.c
+++ b/sys/kern/kern_ntptime.c
@@ -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);
}