aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/librc.c4
-rw-r--r--src/rc-misc.h4
-rw-r--r--src/rc.c31
3 files changed, 21 insertions, 18 deletions
diff --git a/src/librc.c b/src/librc.c
index 9b48b6bb..6d9e46d7 100644
--- a/src/librc.c
+++ b/src/librc.c
@@ -33,13 +33,13 @@ static const char *rc_service_state_names[] = {
bool rc_runlevel_starting (void)
{
- return (rc_is_dir (RC_SVCDIR "/softscripts.old"));
+ return (rc_is_dir (RC_STARTING));
}
librc_hidden_def(rc_runlevel_starting)
bool rc_runlevel_stopping (void)
{
- return (rc_is_dir (RC_SVCDIR "/softscripts.new"));
+ return (rc_is_dir (RC_STOPPING));
}
librc_hidden_def(rc_runlevel_stopping)
diff --git a/src/rc-misc.h b/src/rc-misc.h
index 7f9b824d..f10a83da 100644
--- a/src/rc-misc.h
+++ b/src/rc-misc.h
@@ -21,6 +21,10 @@
#define RC_INITDIR "/etc/init.d"
#define RC_CONFDIR "/etc/conf.d"
+#define RC_KSOFTLEVEL RC_SVCDIR "/ksoftlevel"
+#define RC_STARTING RC_SVCDIR "/softscripts.new"
+#define RC_STOPPING RC_SVCDIR "/softscripts.old"
+
#define RC_SVCDIR_STARTING RC_SVCDIR "/starting"
#define RC_SVCDIR_INACTIVE RC_SVCDIR "/inactive"
#define RC_SVCDIR_STARTED RC_SVCDIR "/started"
diff --git a/src/rc.c b/src/rc.c
index cdb8dd5b..967694ea 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -45,7 +45,6 @@
#define HALTSH RC_INITDIR "/halt.sh"
#define SULOGIN "/sbin/sulogin"
-#define KSOFTLEVEL RC_SVCDIR "/ksoftlevel"
#define INTERACTIVE RC_SVCDIR "/interactive"
#define DEVBOOT "/dev/.rcboot"
@@ -108,10 +107,10 @@ static void cleanup (void)
/* Clean runlevel start, stop markers */
if (! rc_in_plugin) {
- if (rc_is_dir (RC_SVCDIR "softscripts.new"))
- rc_rm_dir (RC_SVCDIR "softscripts.new", true);
- if (rc_is_dir (RC_SVCDIR "softscripts.old"))
- rc_rm_dir (RC_SVCDIR "softscripts.old", true);
+ if (rc_is_dir (RC_STARTING))
+ rc_rm_dir (RC_STARTING, true);
+ if (rc_is_dir (RC_STOPPING))
+ rc_rm_dir (RC_STOPPING, true);
}
}
@@ -543,14 +542,14 @@ static void set_ksoftlevel (const char *runlevel)
strcmp (runlevel, RC_LEVEL_SINGLE) == 0 ||
strcmp (runlevel, RC_LEVEL_SYSINIT) == 0)
{
- if (rc_exists (KSOFTLEVEL) &&
- unlink (KSOFTLEVEL) != 0)
- eerror ("unlink `%s': %s", KSOFTLEVEL, strerror (errno));
+ if (rc_exists (RC_KSOFTLEVEL) &&
+ unlink (RC_KSOFTLEVEL) != 0)
+ eerror ("unlink `%s': %s", RC_KSOFTLEVEL, strerror (errno));
return;
}
- if (! (fp = fopen (KSOFTLEVEL, "w"))) {
- eerror ("fopen `%s': %s", KSOFTLEVEL, strerror (errno));
+ if (! (fp = fopen (RC_KSOFTLEVEL, "w"))) {
+ eerror ("fopen `%s': %s", RC_KSOFTLEVEL, strerror (errno));
return;
}
@@ -563,11 +562,11 @@ static int get_ksoftlevel (char *buffer, int buffer_len)
FILE *fp;
int i = 0;
- if (! rc_exists (KSOFTLEVEL))
+ if (! rc_exists (RC_KSOFTLEVEL))
return (0);
- if (! (fp = fopen (KSOFTLEVEL, "r"))) {
- eerror ("fopen `%s': %s", KSOFTLEVEL, strerror (errno));
+ if (! (fp = fopen (RC_KSOFTLEVEL, "r"))) {
+ eerror ("fopen `%s': %s", RC_KSOFTLEVEL, strerror (errno));
return (-1);
}
@@ -1015,7 +1014,7 @@ int main (int argc, char **argv)
if (rc_is_dir (RC_SVCDIR "failed"))
rc_rm_dir (RC_SVCDIR "failed", false);
- mkdir (RC_SVCDIR "/softscripts.new", 0755);
+ mkdir (RC_STOPPING, 0755);
#ifdef __linux__
/* udev likes to start services before we're ready when it does
@@ -1239,7 +1238,7 @@ int main (int argc, char **argv)
/* Notify the plugins we have finished */
rc_plugin_run (rc_hook_runlevel_stop_out, runlevel);
- rmdir (RC_SVCDIR "/softscripts.new");
+ rmdir (RC_STOPPING);
/* Store the new runlevel */
if (newlevel) {
@@ -1264,7 +1263,7 @@ int main (int argc, char **argv)
sulogin (false);
}
- mkdir (RC_SVCDIR "softscripts.old", 0755);
+ mkdir (RC_STARTING, 0755);
rc_plugin_run (rc_hook_runlevel_start_in, runlevel);
/* Re-add our coldplugged services if they stopped */