openbsd-ports/net/ntp/patches/patch-ntpd_ntpd_c

22 lines
584 B
Plaintext

$OpenBSD: patch-ntpd_ntpd_c,v 1.3 2009/01/26 23:26:02 naddy Exp $
--- ntpd/ntpd.c.orig Sun Aug 17 01:47:31 2008
+++ ntpd/ntpd.c Wed Jan 7 23:44:08 2009
@@ -492,11 +492,16 @@ ntpdmain(
}
#endif
-#if defined(HAVE_GETUID) && !defined(MPE) /* MPE lacks the concept of root */
+#if (defined(HAVE_GETUID) || defined(HAVE_GETEUID)) \
+ && !defined(MPE) /* MPE lacks the concept of root */
{
uid_t uid;
+#if defined(HAVE_GETEUID)
+ uid = geteuid();
+#else
uid = getuid();
+#endif
if (uid)
{
msyslog(LOG_ERR, "ntpd: must be run as root, not uid %ld", (long)uid);