[Initng-svn] r2936 - initng/plugins/reload

svn at initng.thinktux.net svn at initng.thinktux.net
Sat Feb 4 01:13:24 CET 2006


Author: makomk
Date: Sat Feb  4 01:13:24 2006
New Revision: 2936

Modified:
   initng/plugins/reload/initng_reload.c
Log:
Fix compile errors - sorry


Modified: initng/plugins/reload/initng_reload.c
==============================================================================
--- initng/plugins/reload/initng_reload.c	(original)
+++ initng/plugins/reload/initng_reload.c	Sat Feb  4 01:13:24 2006
@@ -27,6 +27,7 @@
 #include <unistd.h>
 #include <assert.h>
 #include <errno.h>
+#include <sys/stat.h>
 
 #include "../../src/initng_handler.h"
 #include "../../src/initng_global.h"
@@ -55,14 +56,14 @@
 
 /* FIXME - not all errors are detected, in some cases success could be 
    reported incorrectly */
-static void read_file(const char *filename)
+static int read_file(const char *filename)
 {
     FILE *fil; int success = TRUE;
 
     fil = fopen(filename, "r");
 
     if (!fil)
-        return;
+        return FALSE;
 
     while (!feof(fil))
     {
@@ -71,7 +72,7 @@
         data_save_struct entry;
 
         if (!fread(&entry, sizeof(entry), 1, fil))
-            success = FALSE; continue;
+            continue;
 
         if (initng_active_db_find_by_name(entry.name))
         {
@@ -91,7 +92,7 @@
         if (!new_entry->current_state)
         {
             F_("Could not find a proper state to set: %s.\n", entry.state);
-            continue;
+            success = FALSE; continue;
         }
 
         /* set service stype */
@@ -341,7 +342,7 @@
 
 static int reload_state(void) 
 {
-    struct stat st;
+    struct stat st; int retval;
     if(stat( g.i_am_init ? SAVE_FILE : SAVE_FILE_FAKE, &st))
     {
 	D_("No state file found, passing on reload_state request\n");
@@ -349,13 +350,13 @@
     }
     if (g.i_am_init)
     {
-        read_file(SAVE_FILE);
+        retval = read_file(SAVE_FILE);
     }
     else
     {
-        read_file(SAVE_FILE_FAKE);
+        retval = read_file(SAVE_FILE_FAKE);
     }
-    return TRUE;
+    return retval ? TRUE : FAIL;
 }
 
 /* Save a reload file for backup if initng segfaults */


More information about the Initng-svn mailing list