summaryrefslogtreecommitdiff
path: root/src/rc/rc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-03-06 11:39:05 +0000
committerRoy Marples <roy@marples.name>2008-03-06 11:39:05 +0000
commit2f22f9dfeb3b741cf059f25b85d1e3bff78fd0a0 (patch)
tree8fda542a160cb4da8fa75148dbf2ea5a143e22b9 /src/rc/rc.c
parent39dd08c5390bdfd6703ea502e723e0236a632fda (diff)
downloadopenrc-2f22f9dfeb3b741cf059f25b85d1e3bff78fd0a0.tar.gz
openrc-2f22f9dfeb3b741cf059f25b85d1e3bff78fd0a0.tar.bz2
openrc-2f22f9dfeb3b741cf059f25b85d1e3bff78fd0a0.tar.xz
Test access instead of euid.
Diffstat (limited to 'src/rc/rc.c')
-rw-r--r--src/rc/rc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/rc/rc.c b/src/rc/rc.c
index 9dc8b0c..82f3a65 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -770,13 +770,6 @@ int main (int argc, char **argv)
newlevel = argv[optind++];
-#ifndef PREFIX
- /* OK, so we really are the main RC process
- * Only root should be able to run us */
- if (geteuid () != 0)
- eerrorx ("%s: root access required", applet);
-#endif
-
/* Enable logging */
setenv ("EINFO_LOG", "rc", 1);
@@ -972,7 +965,12 @@ int main (int argc, char **argv)
/* Clean the failed services state dir */
clean_failed ();
- mkdir (RC_STOPPING, 0755);
+ if (mkdir (RC_STOPPING, 0755) != 0) {
+ if (errno == EACCES)
+ eerrorx ("%s: superuser access required", applet);
+ eerrorx ("%s: failed to create stopping dir: %s",
+ applet, strerror (errno));
+ }
/* Build a list of all services to stop and then work out the
* correct order for stopping them */