aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2018-05-18 16:48:21 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2018-05-18 16:48:21 -0500
commitfaa8318b3ba278544413a39d4a5ae4457711793f (patch)
tree7bdc8f2dd29a428f142194cde461987be856918b
parent08da36149c0b41c64a09369c3eef5e2f5a6fa39c (diff)
Remove the _rc_can_find_pids function
This test to find if we could see pid 1 was being used inconsistently in rc-status and mark_service_crashed to decide whether we could test to see if the daemon for the service was crashed, and it was not part of the librc library. I am removing it from the executables because of inconsistent usage. I will add it to the library if it is needed there.
-rw-r--r--src/includes/rc-misc.h3
-rw-r--r--src/rc/do_service.c4
-rw-r--r--src/rc/rc-misc.c28
-rw-r--r--src/rc/rc-status.c7
4 files changed, 2 insertions, 40 deletions
diff --git a/src/includes/rc-misc.h b/src/includes/rc-misc.h
index e6789911..d05255f4 100644
--- a/src/includes/rc-misc.h
+++ b/src/includes/rc-misc.h
@@ -66,9 +66,6 @@ int parse_mode(mode_t *, char *);
/* Handy function so we can wrap einfo around our deptree */
RC_DEPTREE *_rc_deptree_load (int, int *);
-/* Test to see if we can see pid 1 or not */
-bool _rc_can_find_pids(void);
-
RC_SERVICE lookup_service_state(const char *service);
void from_time_t(char *time_string, time_t tv);
time_t to_time_t(char *timestring);
diff --git a/src/rc/do_service.c b/src/rc/do_service.c
index a36a09ca..5d78e8df 100644
--- a/src/rc/do_service.c
+++ b/src/rc/do_service.c
@@ -68,9 +68,7 @@ int main(int argc, char **argv)
ok = rc_service_started_daemon(service, exec, NULL, idx);
} else if (strcmp(applet, "service_crashed") == 0) {
- ok = (_rc_can_find_pids() &&
- rc_service_daemons_crashed(service) &&
- errno != EACCES);
+ ok = ( rc_service_daemons_crashed(service) && errno != EACCES);
} else
eerrorx("%s: unknown applet", applet);
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
index 50c09747..e933409f 100644
--- a/src/rc/rc-misc.c
+++ b/src/rc/rc-misc.c
@@ -411,34 +411,6 @@ RC_DEPTREE * _rc_deptree_load(int force, int *regen)
return rc_deptree_load();
}
-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);
- if (pids) {
- pid = LIST_FIRST(pids);
- if (pid) {
- retval = true;
- while (pid) {
- pid2 = LIST_NEXT(pid, entries);
- free(pid);
- pid = pid2;
- }
- }
- free(pids);
- }
- return retval;
-}
-
static const struct {
const char * const name;
RC_SERVICE bit;
diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c
index d29f876a..ab80d901 100644
--- a/src/rc/rc-status.c
+++ b/src/rc/rc-status.c
@@ -54,7 +54,6 @@ const char *usagestring = "" \
"Usage: rc-status [options] <runlevel>...\n" \
" or: rc-status [options] [-a | -c | -l | -m | -r | -s | -u]";
-static bool test_crashed = false;
static RC_DEPTREE *deptree;
static RC_STRINGLIST *types;
@@ -145,9 +144,7 @@ print_service(const char *service)
color = ECOLOR_WARN;
} else if (state & RC_SERVICE_STARTED) {
errno = 0;
- if (test_crashed &&
- rc_service_daemons_crashed(service) &&
- errno != EACCES)
+ if (rc_service_daemons_crashed(service) && errno != EACCES)
{
child_pid = rc_service_value_get(service, "child_pid");
start_time = rc_service_value_get(service, "start_time");
@@ -240,8 +237,6 @@ int main(int argc, char **argv)
char *p, *runlevel = NULL;
int opt, retval = 0;
- test_crashed = _rc_can_find_pids();
-
applet = basename_c(argv[0]);
while ((opt = getopt_long(argc, argv, getoptstring, longopts,
(int *) 0)) != -1)