From c996f586deeea47cb4d9a41ed7c7a3f692d9d115 Mon Sep 17 00:00:00 2001 From: Nate Lawson Date: Mon, 25 Jul 2005 16:43:12 +0000 Subject: [PATCH] powerd(8) requires root permissions to run so notify the user if they try to start it without this. Submitted by: Philip S. Schulz MFC after: 2 days --- usr.sbin/powerd/powerd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/powerd/powerd.c b/usr.sbin/powerd/powerd.c index 555218c831b..7c8ab4042cc 100644 --- a/usr.sbin/powerd/powerd.c +++ b/usr.sbin/powerd/powerd.c @@ -269,6 +269,10 @@ main(int argc, char * argv[]) vflag = 0; apm_fd = -1; + /* User must be root to control frequencies. */ + if (geteuid() != 0) + errx(1, "must be root to run"); + while ((ch = getopt(argc, argv, "a:b:i:n:p:r:v")) != EOF) switch (ch) { case 'a':