aboutsummaryrefslogtreecommitdiff
path: root/src/sysvinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysvinit.c')
-rw-r--r--src/sysvinit.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/sysvinit.c b/src/sysvinit.c
index b2975d3..7e0dba6 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -207,22 +207,19 @@ runlevel_index (int n)
return p - valid_runlevels;
}
+struct enstate
+{
+ int mask;
+ int wait;
+};
+
static int
enablecomp (struct prog *prog, void *data)
{
- int *mask = data;
- int wait;
+ struct enstate *s = data;
int rc;
struct component *comp = prog->v.p.comp;
- if (mask)
- {
- wait = *mask & PIES_COMP_WAIT;
- *mask &= ~PIES_COMP_WAIT;
- }
- else
- wait = 0;
-
switch (boot_state)
{
case sysinit:
@@ -246,21 +243,21 @@ enablecomp (struct prog *prog, void *data)
case pies_comp_ondemand:
case pies_comp_powerfailnow:
case pies_comp_kbrequest:
- return mask && (*mask & PIES_COMP_MASK (comp->mode));
+ return s && (s->mask & PIES_COMP_MASK (comp->mode));
default:
break;
- }
+ }
}
rc = !!strchr (comp->runlevels, runlevel);
if (!rc)
return rc;
if (prog->v.p.status == status_finished)
return -1;
- if (wait)
+ if (s && s->mask & PIES_COMP_WAIT)
{
if (comp->mode == pies_comp_wait)
{
- *mask |= PIES_COMP_WAIT;
+ s->wait = 1;
return 1;
}
return 0;
@@ -290,11 +287,16 @@ runlevel_setup_prog (struct prog *prog, void *data)
void
sysvinit_runlevel_setup (int mask, int *wait)
{
+ struct enstate s;
+ s.mask = mask;
if (wait)
- mask |= PIES_COMP_WAIT;
- progman_foreach (runlevel_setup_prog, &mask);
+ {
+ s.mask |= PIES_COMP_WAIT;
+ s.wait = *wait;
+ }
+ progman_foreach (runlevel_setup_prog, &s);
if (wait)
- *wait = mask & PIES_COMP_WAIT;
+ *wait = s.wait;
}
static const char valid_runlevel_arg[] = "0123456789SsQqAaBbCcUu";
@@ -650,11 +652,11 @@ inittrans ()
}
if (newlevel && newlevel != runlevel)
{
- debug (1, ("RL TRANS: %c -> %c", runlevel, newlevel));
+ prevlevel = runlevel ? runlevel : 'N';
+ debug (1, ("RL TRANS: %c -> %c", prevlevel, newlevel));
sysvinit_acct (SYSV_ACCT_RUNLEVEL, "runlevel", "~~",
newlevel + 256 * runlevel, "~");
mf_proctitle_format ("init [%c]", newlevel);
- prevlevel = runlevel ? runlevel : 'N';
runlevel = newlevel;
trans = 1;
wait = 0;

Return to:

Send suggestions and report system problems to the System administrator.