euid 0 should always be able to find pids too.
This commit is contained in:
parent
f6b47568ad
commit
f7f3b6ae09
@ -42,4 +42,4 @@ void run_applets(int, char **);
|
|||||||
RC_DEPTREE *_rc_deptree_load (int *);
|
RC_DEPTREE *_rc_deptree_load (int *);
|
||||||
|
|
||||||
/* Test to see if we can see pid 1 or not */
|
/* Test to see if we can see pid 1 or not */
|
||||||
bool _rc_findpid1(void);
|
bool _rc_can_find_pids(void);
|
||||||
|
@ -44,13 +44,16 @@ extern const char *applet;
|
|||||||
static bool test_crashed = false;
|
static bool test_crashed = false;
|
||||||
static const char *const types_nua[] = { "ineed", "iuse", "iafter", NULL };
|
static const char *const types_nua[] = { "ineed", "iuse", "iafter", NULL };
|
||||||
|
|
||||||
bool _rc_findpid1(void)
|
bool _rc_can_find_pids(void)
|
||||||
{
|
{
|
||||||
RC_PIDLIST *pids;
|
RC_PIDLIST *pids;
|
||||||
RC_PID *pid;
|
RC_PID *pid;
|
||||||
RC_PID *pid2;
|
RC_PID *pid2;
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
|
|
||||||
|
if (geteuid() == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
/* If we cannot see process 1, then we don't test to see if
|
/* If we cannot see process 1, then we don't test to see if
|
||||||
* services crashed or not */
|
* services crashed or not */
|
||||||
pids = rc_find_pids(NULL, NULL, 0, 1);
|
pids = rc_find_pids(NULL, NULL, 0, 1);
|
||||||
@ -151,7 +154,7 @@ int rc_status(int argc, char **argv)
|
|||||||
int opt;
|
int opt;
|
||||||
int depopts = RC_DEP_STRICT | RC_DEP_START | RC_DEP_TRACE;
|
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,
|
while ((opt = getopt_long(argc, argv, getoptstring, longopts,
|
||||||
(int *) 0)) != -1)
|
(int *) 0)) != -1)
|
||||||
|
@ -559,8 +559,10 @@ static RC_SERVICE svc_status(void)
|
|||||||
snprintf(status, sizeof(status), "inactive");
|
snprintf(status, sizeof(status), "inactive");
|
||||||
e = &ewarn;
|
e = &ewarn;
|
||||||
} else if (state & RC_SERVICE_STARTED) {
|
} else if (state & RC_SERVICE_STARTED) {
|
||||||
if (_rc_findpid1() && rc_service_daemons_crashed(service)) {
|
if (_rc_can_find_pids() &&
|
||||||
snprintf(status, sizeof (status), "crashed");
|
rc_service_daemons_crashed(service))
|
||||||
|
{
|
||||||
|
snprintf(status, sizeof(status), "crashed");
|
||||||
e = &eerror;
|
e = &eerror;
|
||||||
} else
|
} else
|
||||||
snprintf(status, sizeof(status), "started");
|
snprintf(status, sizeof(status), "started");
|
||||||
|
Loading…
Reference in New Issue
Block a user