Blob Blame History Raw
commit 7ac022a09450f49bc416e00488ef283db0e98795
Author: Bill Nottingham <notting@redhat.com>
Date:   Wed Feb 1 16:04:13 2012 -0500

    Rework isSimilarlyConfigured() slightly.
    
    Even for stop dependencies, all you need to know is if the service is starting in a subset of the places its dependent service is.

diff --git a/chkconfig.c b/chkconfig.c
index a01afce..f8f759a 100644
--- a/chkconfig.c
+++ b/chkconfig.c
@@ -154,15 +154,11 @@ static inline int earlierThan(int i, int j) {
 	return i;
 }
 
-static int isSimilarlyConfigured(struct service s, struct service t, int start) {
+static int isSimilarlyConfigured(struct service s, struct service t) {
         int state_s, state_t;
 
         state_s = s.currentLevels;
         state_t = t.currentLevels;
-        if (!start) {
-                state_s = ~state_s;
-                state_t = ~state_t;
-        }
         if ((state_s & state_t) == state_s)
                 return 1;
         else
@@ -173,7 +169,7 @@ static void checkDeps(struct service *s, struct dep *deps, struct service *serv,
         int j,k;
 
         for (j = 0; deps[j].name ; j++) {
-                if (!strcmp(deps[j].name, serv->name) && isSimilarlyConfigured(*s, *serv, start)) {
+                if (!strcmp(deps[j].name, serv->name) && isSimilarlyConfigured(*s, *serv)) {
                         if (start)
                                 s->sPriority = laterThan(s->sPriority, serv->sPriority);
                         else
@@ -182,7 +178,7 @@ static void checkDeps(struct service *s, struct dep *deps, struct service *serv,
                 }
                 if (serv->provides) {
                         for (k = 0; serv->provides[k]; k++) {
-                                if (!strcmp(deps[j].name, serv->provides[k]) && isSimilarlyConfigured(*s, *serv, start)) {
+                                if (!strcmp(deps[j].name, serv->provides[k]) && isSimilarlyConfigured(*s, *serv)) {
                                         if (start)
                                                 s->sPriority = laterThan(s->sPriority, serv->sPriority);
                                         else