From 2f22f9dfeb3b741cf059f25b85d1e3bff78fd0a0 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 6 Mar 2008 11:39:05 +0000 Subject: Test access instead of euid. --- src/rc/rc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src') 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 */ -- cgit v1.2.3