Subject: Re: lib/34218: settimeofday(2) causes date(1) command to han
To: None <gnats-bugs@NetBSD.org, lib-bug-people@NetBSD.org,>
From: John Nemeth <firstname.lastname@example.org>
Date: 08/16/2006 14:56:52
Can you try the following patch to lib/libc/settimeofday.c, please?
--- settimeofday.c.orig 2006-08-16 14:35:19.000000000 -0700
+++ settimeofday.c 2006-08-16 14:40:54.000000000 -0700
@@ -84,9 +84,12 @@ try_syscall:
* If credentials changed from root to an unprivilegied
* user, and we already had __clockctl_fd = -1, then we
* tried the system call as a non root user, it failed
- * with EPERM, and we will try clockctl.
+ * with EPERM, and we will try clockctl unless the user
+ * is root which means they probably tried to set the
+ * clock backwards and are not allowed to do so because
+ * of the securelevel.
- if (rv != -1 || errno != EPERM)
+ if (rv != -1 || errno != EPERM || geteuid() == 0)
__clockctl_fd = -2;