Jens Persson escribió:
> This version doesn't not work for me. It doesn't even start. Not even if 
> I put everything in default.runlevel. It's just saying in the beginning 
> something about default, test  and fake. So I'm back with 0.6.8. Sorry I 
> can't give you more help here.

The attached patch adds a new option (--fake), to activate the
fake-mode, and removes the pid check, so it _should_ fix the problem...


Index: initng/src/initng_global.c
===================================================================
--- initng/src/initng_global.c  (revisión: 4598)
+++ initng/src/initng_global.c  (copia de trabajo)
@@ -40,7 +40,7 @@
  * This function initziates the global data struct, with some standard values.
  * This must be set before libinitng can be used in any way
  */
-void initng_global_new(int argc, char *argv[], char *env[], h_i_am i_am)
+void initng_global_new(int argc, char *argv[], char *env[])
 {
        int i;
 
@@ -56,7 +56,7 @@
        memset(&g, 0, sizeof(s_global));
 
        /* Set the i_am */
-       g.i_am = i_am;
+       g.i_am = I_AM_INIT;
 
        /* we want to keep a copy of the arguments passed to us, this will be 
overwritten by set_title() */
        g.Argc = argc;
@@ -181,16 +181,19 @@
                if (strcmp(opt, "verbose") == 0)
                        g.verbose = TRUE;
 #endif
+
                if (strcmp(opt, "i_am_init") == 0)
                        g.i_am = I_AM_INIT;
+
                if (strcmp(opt, "hot_reload") == 0)
                {
                        D_(" Will start after a hot reload ...\n");
                        g.hot_reload = TRUE;
                }
-               if (strcmp(opt, "i_am_not_init") == 0)
-                       g.i_am = I_AM_INIT;
 
+               if (strcmp(opt, "fake") == 0)
+                       g.i_am = I_AM_FAKE_INIT;
+
                if (strcmp(opt, "no_circular") == 0)
                        g.no_circular = TRUE;
 
Index: initng/src/initng_global.h
===================================================================
--- initng/src/initng_global.h  (revisión: 4598)
+++ initng/src/initng_global.h  (copia de trabajo)
@@ -119,7 +119,7 @@
 extern s_global g;
 
 /* functions for initialize and free s_global g */
-void initng_global_new(int argc, char *argv[], char *env[], h_i_am i_am);
+void initng_global_new(int argc, char *argv[], char *env[]);
 void initng_global_free(void);
 
 /* fast macros to set entrys in g */
Index: initng/src/main.c
===================================================================
--- initng/src/main.c   (revisión: 4598)
+++ initng/src/main.c   (copia de trabajo)
@@ -401,16 +401,10 @@
        /* get the time */
        gettimeofday(&last, NULL);
 
-       /* initialise global variables */
-       if (getpid() == 1)
-       {
-               initng_global_new(argc, argv, env, I_AM_INIT);
-       }
-       else
-       {
-               initng_global_new(argc, argv, env, I_AM_FAKE_INIT);
-       }
 
+       /* initialize global variables */
+       initng_global_new(argc, argv, env);
+
        if (getuid() != 0)
        {
                W_("Initng is designed to run as root user, a lot of 
functionality will not work correctly.\n");
Index: initng/tools/itool.c
===================================================================
--- initng/tools/itool.c        (revisión: 4598)
+++ initng/tools/itool.c        (copia de trabajo)
@@ -99,7 +99,8 @@
           argv[1], argv[2]); */
 
        /* initialise global variables */
-       initng_global_new(argc, argv, env, I_AM_UTILITY);
+       initng_global_new(argc, argv, env);
+       g.i_am = I_AM_UTILITY;
 
        /* Load all plugins */
        if (!initng_load_module_load_all(INITNG_PLUGIN_DIR))
Index: initng/devtool/test_parser.c
===================================================================
--- initng/devtool/test_parser.c        (revisión: 4598)
+++ initng/devtool/test_parser.c        (copia de trabajo)
@@ -95,7 +95,8 @@
        service_cache_h *current = NULL;
 
        /* initialise global variables */
-       initng_global_new(argc, argv, env, I_AM_UTILITY);
+       initng_global_new(argc, argv, env);
+       g.i_am = I_AM_UTILITY;
 
        if (!initng_load_module_load_all(INITNG_PLUGIN_DIR))
        {
@@ -308,7 +309,7 @@
        service = initng_common_parse_service(name);
        if (!service)
        {
-               /* unload all modules 
+               /* unload all modules
                   initng_unload_all_modules();
                   initng_free();
                   exit(2);
-- 
_______________________________________________
Initng mailing list
[email protected]
http://jw.dyndns.org/mailman/listinfo/initng

Reply via email to