aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-05-12 23:17:45 +0000
committerRoy Marples <roy@marples.name>2008-05-12 23:17:45 +0000
commita89171ee9b20ec7062f77dc651fa873690fb50d5 (patch)
tree0839c011aeb928db2fbb1d280063722d7b19cebd
parent6d5d655b5212672319780e7c25a4da955eebcf75 (diff)
When stopping, stop services that need our provide as well, #79.
-rw-r--r--src/rc/runscript.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index e234b766..edc704e8 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -103,6 +103,7 @@ static RC_STRINGLIST *types_nu = NULL;
static RC_STRINGLIST *types_nua = NULL;
static RC_STRINGLIST *types_m = NULL;
static RC_STRINGLIST *types_mua = NULL;
+static RC_STRINGLIST *types_p = NULL;
#ifdef __linux__
static void (*selinux_run_init_old)(void);
@@ -335,6 +336,7 @@ static void cleanup(void)
rc_stringlist_free(types_nua);
rc_stringlist_free(types_m);
rc_stringlist_free(types_mua);
+ rc_stringlist_free(types_p);
rc_plugin_unload();
rc_deptree_free(deptree);
@@ -649,6 +651,9 @@ static void setup_types(void)
rc_stringlist_add(types_mua, "needsme");
rc_stringlist_add(types_mua, "usesme");
rc_stringlist_add(types_mua, "beforeme");
+
+ types_p = rc_stringlist_new();
+ rc_stringlist_add(types_p, "iprovide");
}
static bool in_list(RC_STRINGLIST *list, char *string)
@@ -947,9 +952,15 @@ static void svc_stop(bool deps)
if (! types_m)
setup_types();
- tmplist = NULL;
- services = rc_deptree_depends(deptree, types_m, applet_list,
+ tmplist = rc_deptree_depends(deptree, types_p, applet_list,
+ runlevel, 0);
+ if (!tmplist)
+ tmplist = rc_stringlist_new();
+ rc_stringlist_add(tmplist, applet);
+ services = rc_deptree_depends(deptree, types_m, tmplist,
runlevel, depoptions);
+ rc_stringlist_free(tmplist);
+ tmplist = NULL;
if (services) {
TAILQ_FOREACH_REVERSE(svc, services, rc_stringlist, entries) {
state = rc_service_state(svc->value);