Only require privilege to set the current time adjustment, not in order to

query it.
This commit is contained in:
Robert Watson 2007-06-14 18:37:58 +00:00
parent a2346f7c3c
commit b4be6ef22f

View File

@ -950,9 +950,6 @@ kern_adjtime(struct thread *td, struct timeval *delta, struct timeval *olddelta)
struct timeval atv; struct timeval atv;
int error; int error;
if ((error = priv_check(td, PRIV_ADJTIME)))
return (error);
mtx_lock(&Giant); mtx_lock(&Giant);
if (olddelta) { if (olddelta) {
atv.tv_sec = time_adjtime / 1000000; atv.tv_sec = time_adjtime / 1000000;
@ -963,10 +960,15 @@ kern_adjtime(struct thread *td, struct timeval *delta, struct timeval *olddelta)
} }
*olddelta = atv; *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 + time_adjtime = (int64_t)delta->tv_sec * 1000000 +
delta->tv_usec; delta->tv_usec;
}
mtx_unlock(&Giant); mtx_unlock(&Giant);
return (error); return (0);
} }