diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2008-05-29 09:17:30 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2008-05-29 09:17:30 -0700 |
commit | f7934805253c8ab03d6c0490da167ad5e0375694 (patch) | |
tree | cc8098f2144e26f3d8d8c9a0ea7ffcef48067580 | |
parent | f0640937d2b29aec1d8b35102fbd1155b37f264c (diff) |
Don't add scripts to the remove list when they're not active
The dep removal logic was always adding the requested services to the
remove list, causing all links to be rewritten. Now, check if it's
active before adding it. This means that requesting to remove an
inactive script will just do nothing.
-rw-r--r-- | lib/rdep.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -75,6 +75,7 @@ initd_list_t *initd_remove_recurse_deps(initd_list_t *pool, initd_list_t *rmlist = NULL, *all = NULL, *chain = NULL; initd_t *ip; int n; + initd_key_t akey, rmkey; dep_t *all_active = NULL; char *rm; @@ -91,6 +92,14 @@ initd_list_t *initd_remove_recurse_deps(initd_list_t *pool, /* initialize the initd remove list */ rmlist = initd_list_new(); + if (sk == SK_START) { + akey = KEY_ASTART; + rmkey = KEY_RMSTART; + } else { + akey = KEY_ASTOP; + rmkey = KEY_RMSTOP; + } + /* Check that the specified services to remove are in the pool. * If they are, clear their changed bits to mark them for * removal. */ @@ -107,11 +116,13 @@ initd_list_t *initd_remove_recurse_deps(initd_list_t *pool, if (initd_list_exists_name(rmlist, ip->name)) continue; + /* If the script isn't currently active in any level, we + * can move along. */ + if (!initd_is_active(ip, RC_ALL, akey)) + continue; + /* Set the remove field for all levels */ - if (sk == SK_START) - initd_set_rc(ip, KEY_RMSTART, RC_ALL); - else - initd_set_rc(ip, KEY_RMSTOP, RC_ALL); + initd_set_rc(ip, rmkey, RC_ALL); /* Add the initd_t to the rmlist */ initd_list_add(rmlist, initd_copy(ip)); |