diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/librc.c | 12 | ||||
-rw-r--r-- | src/rc-status.c | 16 | ||||
-rw-r--r-- | src/rc.h | 3 | ||||
-rw-r--r-- | src/runscript.c | 9 |
4 files changed, 17 insertions, 23 deletions
diff --git a/src/librc.c b/src/librc.c index f3495cbe..96588e3f 100644 --- a/src/librc.c +++ b/src/librc.c @@ -339,9 +339,8 @@ bool rc_mark_service (const char *service, const rc_service_state_t state) if ((s != skip_state && s != RC_SERVICE_STOPPED && s != RC_SERVICE_COLDPLUGGED && - s != RC_SERVICE_SCHEDULED && - s != RC_SERVICE_CRASHED) && - (! skip_wasinactive || i != RC_SERVICE_WASINACTIVE)) + s != RC_SERVICE_SCHEDULED) && + (! skip_wasinactive || s != RC_SERVICE_WASINACTIVE)) { file = rc_strcatpaths (RC_SVCDIR, rc_parse_service_state(s), base, (char *) NULL); @@ -351,7 +350,7 @@ bool rc_mark_service (const char *service, const rc_service_state_t state) s == RC_SERVICE_INACTIVE) { char *wasfile = rc_strcatpaths (RC_SVCDIR, - rc_parse_service_state (RC_SERVICE_WASINACTIVE), + rc_parse_service_state (RC_SERVICE_WASINACTIVE), base, (char *) NULL); if (symlink (init, wasfile) != 0) @@ -457,11 +456,6 @@ rc_service_state_t rc_service_state (const char *service) } } - if (state & RC_SERVICE_STARTED && geteuid () == 0) { - if (rc_service_daemons_crashed (service)) - state |= RC_SERVICE_CRASHED; - } - return (state); } librc_hidden_def(rc_service_state) diff --git a/src/rc-status.c b/src/rc-status.c index dacbe851..b862a27c 100644 --- a/src/rc-status.c +++ b/src/rc-status.c @@ -35,23 +35,25 @@ static void print_service (char *service) einfo_color_t color = ECOLOR_BAD; if (state & RC_SERVICE_STOPPING) - snprintf (status, sizeof (status), "stopping "); + snprintf (status, sizeof (status), "stopping "); else if (state & RC_SERVICE_STARTING) { snprintf (status, sizeof (status), "starting "); color = ECOLOR_WARN; } else if (state & RC_SERVICE_INACTIVE) { snprintf (status, sizeof (status), "inactive "); color = ECOLOR_WARN; - } else if (state & RC_SERVICE_CRASHED) - snprintf (status, sizeof (status), " crashed "); - else if (state & RC_SERVICE_STARTED) { - snprintf (status, sizeof (status), " started "); - color = ECOLOR_GOOD; + } else if (state & RC_SERVICE_STARTED) { + if (geteuid () == 0 && rc_service_daemons_crashed (service)) + snprintf (status, sizeof (status), " crashed "); + else { + snprintf (status, sizeof (status), " started "); + color = ECOLOR_GOOD; + } } else if (state & RC_SERVICE_SCHEDULED) { snprintf (status, sizeof (status), "scheduled"); color = ECOLOR_WARN; } else - snprintf (status, sizeof (status), " stopped "); + snprintf (status, sizeof (status), " stopped "); ebracket (cols, color, status); } @@ -57,9 +57,6 @@ typedef enum RC_SERVICE_FAILED = 0x0200, RC_SERVICE_SCHEDULED = 0x0400, RC_SERVICE_WASINACTIVE = 0x0800, - - /* Regardless of state, service may have crashed daemons */ - RC_SERVICE_CRASHED = 0x1000 } rc_service_state_t; /*! Resolves a service name to its full path. diff --git a/src/runscript.c b/src/runscript.c index dfe41850..bd404cd2 100644 --- a/src/runscript.c +++ b/src/runscript.c @@ -459,11 +459,12 @@ static rc_service_state_t svc_status () } else if (state & RC_SERVICE_INACTIVE) { snprintf (status, sizeof (status), "inactive"); e = &ewarn; - } else if (state & RC_SERVICE_CRASHED) { - snprintf (status, sizeof (status), "crashed"); - e = &eerror; } else if (state & RC_SERVICE_STARTED) { - snprintf (status, sizeof (status), "started"); + if (geteuid () == 0 && rc_service_daemons_crashed (service)) { + snprintf (status, sizeof (status), "crashed"); + e = &eerror; + } else + snprintf (status, sizeof (status), "started"); } else snprintf (status, sizeof (status), "stopped"); |