diff options
author | Karel Zak | 2014-07-28 13:00:54 +0200 |
---|---|---|
committer | Karel Zak | 2014-07-29 08:27:00 +0200 |
commit | 68030a76d7f7f3214138407efb615cfe6e0cf170 (patch) | |
tree | d538a74cb61762b5bc91019c70f674391c28b058 /sys-utils | |
parent | agetty: Reprompt and reprint /etc/issue when asked (diff) | |
download | kernel-qcow2-util-linux-68030a76d7f7f3214138407efb615cfe6e0cf170.tar.gz kernel-qcow2-util-linux-68030a76d7f7f3214138407efb615cfe6e0cf170.tar.xz kernel-qcow2-util-linux-68030a76d7f7f3214138407efb615cfe6e0cf170.zip |
hwclock: check for permissions before use clock interface
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/hwclock.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index a934acea2..474e04fdc 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -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) |