]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: move rtc permissions test
authorJ William Piggott <elseifthen@gmx.com>
Sat, 29 Jul 2017 00:51:31 +0000 (20:51 -0400)
committerJ William Piggott <elseifthen@gmx.com>
Fri, 4 Aug 2017 12:53:44 +0000 (08:53 -0400)
Move the rtc permissions test below the systz call and
simplify it's 'if' test.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
sys-utils/hwclock.c

index cec712d891f2a7d1cc56d4386d1e2ea63ce99c90..ad9c502d383c5ead3048db6ec9ead0c398cca1a4 100644 (file)
@@ -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 */