Fix starting state and clean some whitespace
This commit is contained in:
parent
9fa717fb1d
commit
c8de77fbbe
4
src/rc.c
4
src/rc.c
@ -284,7 +284,7 @@ static int do_service (int argc, char **argv)
|
|||||||
else if (strcmp (applet, "service_inactive") == 0)
|
else if (strcmp (applet, "service_inactive") == 0)
|
||||||
ok = (rc_service_state (argv[0]) & RC_SERVICE_INACTIVE);
|
ok = (rc_service_state (argv[0]) & RC_SERVICE_INACTIVE);
|
||||||
else if (strcmp (applet, "service_starting") == 0)
|
else if (strcmp (applet, "service_starting") == 0)
|
||||||
ok = (rc_service_state (argv[0]) & RC_SERVICE_STOPPING);
|
ok = (rc_service_state (argv[0]) & RC_SERVICE_STARTING);
|
||||||
else if (strcmp (applet, "service_stopping") == 0)
|
else if (strcmp (applet, "service_stopping") == 0)
|
||||||
ok = (rc_service_state (argv[0]) & RC_SERVICE_STOPPING);
|
ok = (rc_service_state (argv[0]) & RC_SERVICE_STOPPING);
|
||||||
else if (strcmp (applet, "service_coldplugged") == 0)
|
else if (strcmp (applet, "service_coldplugged") == 0)
|
||||||
@ -318,7 +318,7 @@ static int do_mark_service (int argc, char **argv)
|
|||||||
else if (strcmp (applet, "mark_service_inactive") == 0)
|
else if (strcmp (applet, "mark_service_inactive") == 0)
|
||||||
ok = rc_service_mark (argv[0], RC_SERVICE_INACTIVE);
|
ok = rc_service_mark (argv[0], RC_SERVICE_INACTIVE);
|
||||||
else if (strcmp (applet, "mark_service_starting") == 0)
|
else if (strcmp (applet, "mark_service_starting") == 0)
|
||||||
ok = rc_service_mark (argv[0], RC_SERVICE_STOPPING);
|
ok = rc_service_mark (argv[0], RC_SERVICE_STARTING);
|
||||||
else if (strcmp (applet, "mark_service_stopping") == 0)
|
else if (strcmp (applet, "mark_service_stopping") == 0)
|
||||||
ok = rc_service_mark (argv[0], RC_SERVICE_STOPPING);
|
ok = rc_service_mark (argv[0], RC_SERVICE_STOPPING);
|
||||||
else if (strcmp (applet, "mark_service_coldplugged") == 0)
|
else if (strcmp (applet, "mark_service_coldplugged") == 0)
|
||||||
|
@ -261,6 +261,7 @@ static void restore_state (void)
|
|||||||
|
|
||||||
state = rc_service_state (applet);
|
state = rc_service_state (applet);
|
||||||
if (state & RC_SERVICE_STOPPING) {
|
if (state & RC_SERVICE_STOPPING) {
|
||||||
|
|
||||||
if (state & RC_SERVICE_WASINACTIVE)
|
if (state & RC_SERVICE_WASINACTIVE)
|
||||||
rc_service_mark (applet, RC_SERVICE_INACTIVE);
|
rc_service_mark (applet, RC_SERVICE_INACTIVE);
|
||||||
else
|
else
|
||||||
@ -477,7 +478,7 @@ static rc_service_state_t svc_status ()
|
|||||||
if (state & RC_SERVICE_STOPPING) {
|
if (state & RC_SERVICE_STOPPING) {
|
||||||
snprintf (status, sizeof (status), "stopping");
|
snprintf (status, sizeof (status), "stopping");
|
||||||
e = &ewarn;
|
e = &ewarn;
|
||||||
} else if (state & RC_SERVICE_STOPPING) {
|
} else if (state & RC_SERVICE_STARTING) {
|
||||||
snprintf (status, sizeof (status), "starting");
|
snprintf (status, sizeof (status), "starting");
|
||||||
e = &ewarn;
|
e = &ewarn;
|
||||||
} else if (state & RC_SERVICE_INACTIVE) {
|
} else if (state & RC_SERVICE_INACTIVE) {
|
||||||
@ -576,14 +577,14 @@ static void svc_start (bool deps)
|
|||||||
|
|
||||||
if (state & RC_SERVICE_STARTED)
|
if (state & RC_SERVICE_STARTED)
|
||||||
ewarnx ("WARNING: %s has already been started", applet);
|
ewarnx ("WARNING: %s has already been started", applet);
|
||||||
else if (state & RC_SERVICE_STOPPING)
|
else if (state & RC_SERVICE_STARTING)
|
||||||
ewarnx ("WARNING: %s is already starting", applet);
|
ewarnx ("WARNING: %s is already starting", applet);
|
||||||
else if (state & RC_SERVICE_STOPPING)
|
else if (state & RC_SERVICE_STOPPING)
|
||||||
ewarnx ("WARNING: %s is stopping", applet);
|
ewarnx ("WARNING: %s is stopping", applet);
|
||||||
else if (state & RC_SERVICE_INACTIVE && ! background)
|
else if (state & RC_SERVICE_INACTIVE && ! background)
|
||||||
ewarnx ("WARNING: %s has already started, but is inactive", applet);
|
ewarnx ("WARNING: %s has already started, but is inactive", applet);
|
||||||
|
|
||||||
if (! rc_service_mark (service, RC_SERVICE_STOPPING))
|
if (! rc_service_mark (service, RC_SERVICE_STARTING))
|
||||||
eerrorx ("ERROR: %s has been started by something else", applet);
|
eerrorx ("ERROR: %s has been started by something else", applet);
|
||||||
|
|
||||||
make_exclusive (service);
|
make_exclusive (service);
|
||||||
@ -644,7 +645,7 @@ static void svc_start (bool deps)
|
|||||||
|
|
||||||
/* Don't wait for services which went inactive but are now in
|
/* Don't wait for services which went inactive but are now in
|
||||||
* starting state which we are after */
|
* starting state which we are after */
|
||||||
if (svcs & RC_SERVICE_STOPPING &&
|
if (svcs & RC_SERVICE_STARTING &&
|
||||||
svcs & RC_SERVICE_WASINACTIVE) {
|
svcs & RC_SERVICE_WASINACTIVE) {
|
||||||
bool use = false;
|
bool use = false;
|
||||||
STRLIST_FOREACH (use_services, svc2, j)
|
STRLIST_FOREACH (use_services, svc2, j)
|
||||||
@ -953,7 +954,7 @@ static const char * const longopts_help[] = {
|
|||||||
#undef case_RC_COMMON_getopt_case_h
|
#undef case_RC_COMMON_getopt_case_h
|
||||||
#define case_RC_COMMON_getopt_case_h \
|
#define case_RC_COMMON_getopt_case_h \
|
||||||
execl (RCSCRIPT_HELP, RCSCRIPT_HELP, service, (char *) NULL); \
|
execl (RCSCRIPT_HELP, RCSCRIPT_HELP, service, (char *) NULL); \
|
||||||
eerrorx ("%s: failed to exec `" RCSCRIPT_HELP "': %s", applet, strerror (errno));
|
eerrorx ("%s: failed to exec `" RCSCRIPT_HELP "': %s", applet, strerror (errno));
|
||||||
#include "_usage.c"
|
#include "_usage.c"
|
||||||
|
|
||||||
int runscript (int argc, char **argv)
|
int runscript (int argc, char **argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user