[Initng-svn] r2947 - initng/src

svn at initng.thinktux.net svn at initng.thinktux.net
Mon Feb 6 12:06:54 CET 2006


Author: jimmy
Date: Mon Feb  6 12:06:53 2006
New Revision: 2947

Modified:
   initng/src/initng_common.c
Log:
Alter IS_CHANGE.


Modified: initng/src/initng_common.c
==============================================================================
--- initng/src/initng_common.c	(original)
+++ initng/src/initng_common.c	Mon Feb  6 12:06:53 2006
@@ -371,16 +371,10 @@
     assert(service);
     assert(service->name);
     assert(service->current_state);
+    assert(state);
 
     D_("mark_service(%s, %s);\n", service->name, state->state_name);
-
-    /* make sure there is a state to set */
-    if (!state)
-    {
-        F_("Can't set an empty state!\n");
-        return (FALSE);
-    }
-
+    
     /* 1: Test if already set */
     if (service->current_state == state)
     {
@@ -393,7 +387,7 @@
 
     /* call service state hooks */
     hook = safe = NULL;
-    if (state && state->list.next && state->list.prev)
+    if (state->list.next && state->list.prev)
     {
         while_active_state_hooks_safe(hook, safe, state)
         {
@@ -432,6 +426,14 @@
     memcpy(&service->time_last_state, &service->time_current_state,
            sizeof(struct timeval));
 
+    /* update rught last to */
+    if (service->last_rought_state != service->current_state->is)
+    {
+	service->last_rought_state=service->current_state->is;
+        memcpy(&service->last_rought_time, &service->time_current_state,
+               sizeof(memcpy));
+    }
+
     /* set state and time */
     service->current_state = state;
     gettimeofday(&service->time_current_state, NULL);
@@ -466,7 +468,20 @@
             return (FALSE);
         }
     }
-
+    
+    /* If the rough state has changed */
+    if (service->last_rought_state != service->current_state->is)
+    {
+	current = q = NULL;
+	while_list_safe(current, &g.IS_CHANGE, q)
+	{
+    	    if ((*current->c.status_change) (service) <= FALSE)
+    	    {
+        	D_("Some plugin return FALSE when service %s IS_CHANGE to %s hook called, aborting here.\n", service->name, service->current_state->state_name);
+        	return (FALSE);
+    	    }
+	}
+    }
 
     /* This checks if all services on a runlevel is up, then set STATE_UP */
     if (IS_UP(service))
@@ -490,14 +505,6 @@
        }
      */
 
-    /* update last big change time */
-    if (service->last_rought_state != service->current_state->is)
-    {
-        service->last_rought_state = service->current_state->is;
-        memcpy(&service->last_rought_time, &service->time_current_state,
-               sizeof(memcpy));
-    }
-
     D_("service %s is now %s.\n", service->name,
        service->current_state->state_name);
     return (TRUE);


More information about the Initng-svn mailing list