From: J William Piggott Date: Sun, 15 Mar 2015 20:44:05 +0000 (-0400) Subject: hwclock: non-root access in test mode X-Git-Tag: v2.27-rc1~340 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a0e215fb2d501acbcb81c0e65e181b6536bc61bd;p=thirdparty%2Futil-linux.git hwclock: non-root access in test mode Allow a non-root user to call all hwclock functions when the --test option is used. Signed-off-by: J William Piggott --- diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index e8732b8bc4..e1e5816b2a 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -1914,15 +1914,15 @@ int main(int argc, char **argv) permitted = TRUE; else { /* program is designed to run setuid (in some situations) */ - if (set || systohc || adjust) { + if ((set || systohc || adjust) && !testing) { warnx(_("Sorry, only the superuser can change " "the Hardware Clock.")); permitted = FALSE; - } else if (systz || hctosys) { + } else if ((systz || hctosys) && !testing) { warnx(_("Sorry, only the superuser can change " "the System Clock.")); permitted = FALSE; - } else if (setepoch) { + } else if (setepoch && !testing) { warnx(_("Sorry, only the superuser can change the " "Hardware Clock epoch in the kernel.")); permitted = FALSE;