]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: check for permissions before use clock interface
authorKarel Zak <kzak@redhat.com>
Mon, 28 Jul 2014 11:00:54 +0000 (13:00 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 29 Jul 2014 06:27:00 +0000 (08:27 +0200)
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/hwclock.c

index a934acea212b9dda8b8ab6df52eec084a42c43c2..474e04fdc627e26e67066d19b223ad179e2e0f50 100644 (file)
@@ -1495,6 +1495,9 @@ static int compare_clock (const bool utc, const bool local_opt)
        bool hclock_valid = FALSE, universal, first_pass = TRUE;
        int rc;
 
+       if (ur->get_permissions())
+               return EX_NOPERM;
+
        /* dummy call for increased precision */
        gettimeofday(&tv, NULL);
 
@@ -1893,7 +1896,7 @@ int main(int argc, char **argv)
        }
 
        if (!(show | set | systohc | hctosys | systz | adjust | getepoch
-             | setepoch | predict))
+             | setepoch | predict | compare))
                show = 1;       /* default to show */
 
        if (getuid() == 0)