]> mj.ucw.cz Git - libucw.git/blobdiff - lib/conf-input.c
bgetl() should return uns instead of u32
[libucw.git] / lib / conf-input.c
index a625630a4f9b46731ea7d2a95970389f36904e7a..c5d2527772548911bd3f163b115392e90f2f3035 100644 (file)
@@ -284,6 +284,11 @@ error:
 #endif
 char *cf_def_file = DEFAULT_CONFIG;
 
+#ifndef ENV_VAR_CONFIG
+#define ENV_VAR_CONFIG NULL
+#endif
+char *cf_env_file = ENV_VAR_CONFIG;
+
 static uns postpone_commit;                    // only for cf_getopt()
 static uns everything_committed;               // after the 1st load, this flag is set on
 
@@ -381,15 +386,20 @@ load_default(void)
 {
   if (cf_def_file)
     {
-      char *env = getenv("SH_CONFIG");
-      if (env)
+      char *env;
+      if (cf_env_file && (env = getenv(cf_env_file)))
         {
          if (cf_load(env))
            die("Cannot load config file %s", env);
        }
-      if (cf_load(cf_def_file))
+      else if (cf_load(cf_def_file))
         die("Cannot load default config %s", cf_def_file);
     }
+  else
+    {
+      // We need to create an empty pool
+      cf_journal_commit_transaction(1, cf_journal_new_transaction(1));
+    }
 }
 
 static void