From: J William Piggott Date: Sat, 29 Jul 2017 00:51:31 +0000 (-0400) Subject: hwclock: move rtc permissions test X-Git-Tag: v2.31-rc1~144^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=551e703401f62553337b47056e144ce88d8179ed;p=thirdparty%2Futil-linux.git hwclock: move rtc permissions test Move the rtc permissions test below the systz call and simplify it's 'if' test. Signed-off-by: J William Piggott --- diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index cec712d891..ad9c502d38 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -1037,9 +1037,6 @@ manipulate_clock(const struct hwclock_control *ctl, const time_t set_time, /* local return code */ int rc = 0; - if (!ctl->systz && !ctl->predict && ur->get_permissions()) - return EX_NOPERM; - if ((ctl->set || ctl->systohc || ctl->adjust) && (adjtime->local_utc == UTC) != ctl->universal) { adjtime->local_utc = ctl->universal ? UTC : LOCAL; @@ -1049,6 +1046,9 @@ manipulate_clock(const struct hwclock_control *ctl, const time_t set_time, if (ctl->systz) return set_system_clock_timezone(ctl); + if (!ctl->predict && ur->get_permissions()) + return EX_NOPERM; + if (ctl->show || ctl->get || ctl->adjust || ctl->hctosys || (!ctl->noadjfile && !ctl->predict)) { /* data from HW-clock are required */