euid 0 should always be able to find pids too.
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user