From: Karel Zak Date: Mon, 28 Jul 2014 11:00:54 +0000 (+0200) Subject: hwclock: check for permissions before use clock interface X-Git-Tag: v2.26-rc1~577 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68030a76d7f7f3214138407efb615cfe6e0cf170;p=thirdparty%2Futil-linux.git hwclock: check for permissions before use clock interface Reported-by: Benno Schulenberg Signed-off-by: Karel Zak --- diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index a934acea21..474e04fdc6 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)