aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-03-21 17:41:01 +0000
committerRoy Marples <roy@marples.name>2008-03-21 17:41:01 +0000
commitf7f3b6ae093106e0f86556d1424af30e2122192a (patch)
treea3db29faadd4e630d6d6ba90ad486f8d6b8d45f1 /src
parentf6b47568ad9a103c5c84d9e9005a51be87273026 (diff)
euid 0 should always be able to find pids too.
Diffstat (limited to 'src')
-rw-r--r--src/rc/builtins.h2
-rw-r--r--src/rc/rc-status.c7
-rw-r--r--src/rc/runscript.c6
3 files changed, 10 insertions, 5 deletions
diff --git a/src/rc/builtins.h b/src/rc/builtins.h
index e87e1ca4..c8d0958d 100644
--- a/src/rc/builtins.h
+++ b/src/rc/builtins.h
@@ -42,4 +42,4 @@ void run_applets(int, char **);
RC_DEPTREE *_rc_deptree_load (int *);
/* Test to see if we can see pid 1 or not */
-bool _rc_findpid1(void);
+bool _rc_can_find_pids(void);
diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c
index ef58a147..1e0ef38c 100644
--- a/src/rc/rc-status.c
+++ b/src/rc/rc-status.c
@@ -44,13 +44,16 @@ extern const char *applet;
static bool test_crashed = false;
static const char *const types_nua[] = { "ineed", "iuse", "iafter", NULL };
-bool _rc_findpid1(void)
+bool _rc_can_find_pids(void)
{
RC_PIDLIST *pids;
RC_PID *pid;
RC_PID *pid2;
bool retval = false;
+ if (geteuid() == 0)
+ return true;
+
/* If we cannot see process 1, then we don't test to see if
* services crashed or not */
pids = rc_find_pids(NULL, NULL, 0, 1);
@@ -151,7 +154,7 @@ int rc_status(int argc, char **argv)
int opt;
int depopts = RC_DEP_STRICT | RC_DEP_START | RC_DEP_TRACE;
- test_crashed = _rc_findpid1();
+ test_crashed = _rc_can_find_pids();
while ((opt = getopt_long(argc, argv, getoptstring, longopts,
(int *) 0)) != -1)
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index 9263cea1..d4500044 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -559,8 +559,10 @@ static RC_SERVICE svc_status(void)
snprintf(status, sizeof(status), "inactive");
e = &ewarn;
} else if (state & RC_SERVICE_STARTED) {
- if (_rc_findpid1() && rc_service_daemons_crashed(service)) {
- snprintf(status, sizeof (status), "crashed");
+ if (_rc_can_find_pids() &&
+ rc_service_daemons_crashed(service))
+ {
+ snprintf(status, sizeof(status), "crashed");
e = &eerror;
} else
snprintf(status, sizeof(status), "started");