gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: -do load default configuration even if '


From: gnunet
Subject: [gnunet] branch master updated: -do load default configuration even if 'gnunet.conf' does not exist
Date: Sun, 29 Aug 2021 23:39:46 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 34822f004 -do load default configuration even if 'gnunet.conf' does 
not exist
34822f004 is described below

commit 34822f004386e6e727a8a8917f91bce367457b84
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Aug 29 23:35:56 2021 +0200

    -do load default configuration even if 'gnunet.conf' does not exist
---
 src/util/configuration.c |  7 -----
 src/util/program.c       | 72 +++++++++++++++++++++++++-----------------------
 2 files changed, 38 insertions(+), 41 deletions(-)

diff --git a/src/util/configuration.c b/src/util/configuration.c
index 62c06ae23..09a3a7d93 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -2362,13 +2362,6 @@ GNUNET_CONFIGURATION_default_filename (void)
     return cfg_fn;
   GNUNET_free (cfg_fn);
 
-  GNUNET_asprintf (&cfg_fn,
-                   "/etc/%s",
-                   pd->config_file);
-  if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn))
-    return cfg_fn;
-  GNUNET_free (cfg_fn);
-
   GNUNET_asprintf (&cfg_fn,
                    "/etc/%s/%s",
                    pd->project_dirname,
diff --git a/src/util/program.c b/src/util/program.c
index a79e07d19..b9da14572 100644
--- a/src/util/program.c
+++ b/src/util/program.c
@@ -244,12 +244,23 @@ GNUNET_PROGRAM_run2 (int argc,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Loading configuration from entry point specified as option 
(%s)\n",
                 cc.cfgfile);
-    if ((GNUNET_YES != GNUNET_DISK_file_test (cc.cfgfile)) ||
-        (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cc.cfgfile)))
+    if (GNUNET_YES !=
+        GNUNET_DISK_file_test (cc.cfgfile))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ (
-                    "Unreadable or malformed configuration file `%s', exit 
...\n"),
+                  _ ("Unreadable configuration file `%s', exiting ...\n"),
+                  cc.cfgfile);
+      ret = GNUNET_SYSERR;
+      GNUNET_free (allopts);
+      GNUNET_free (lpfx);
+      goto cleanup;
+    }
+    if (GNUNET_SYSERR ==
+        GNUNET_CONFIGURATION_load (cfg,
+                                   cc.cfgfile))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  _ ("Malformed configuration file `%s', exiting ...\n"),
                   cc.cfgfile);
       ret = GNUNET_SYSERR;
       GNUNET_free (allopts);
@@ -259,38 +270,31 @@ GNUNET_PROGRAM_run2 (int argc,
   }
   else
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Loading configuration default entry point (%s)\n",
-                cc.cfgfile);
-    if ((NULL != cfg_fn) && (GNUNET_YES == GNUNET_DISK_file_test (cfg_fn)))
+    if ( (NULL != cfg_fn) &&
+         (GNUNET_YES !=
+          GNUNET_DISK_file_test (cfg_fn)) )
     {
-      if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cfg_fn))
-      {
-        GNUNET_log (
-          GNUNET_ERROR_TYPE_ERROR,
-          _ (
-            "Unreadable or malformed default configuration file `%s', exit 
...\n"),
-          cfg_fn);
-        ret = GNUNET_SYSERR;
-        GNUNET_free (allopts);
-        GNUNET_free (lpfx);
-        goto cleanup;
-      }
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  _ ("Unreadable configuration file `%s'. Exiting ...\n"),
+                  cfg_fn);
+      ret = GNUNET_SYSERR;
+      GNUNET_free (allopts);
+      GNUNET_free (lpfx);
+      goto cleanup;
     }
-    else if (NULL != cfg_fn)
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Loading configuration from entry point `%s'\n",
+                cc.cfgfile);
+    if (GNUNET_SYSERR ==
+        GNUNET_CONFIGURATION_load (cfg,
+                                   cfg_fn))
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Loading configuration without entry point\n");
-      GNUNET_free (cfg_fn);
-      if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, NULL))
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                    _ ("Unreadable or malformed configuration, exit ...\n"));
-        ret = GNUNET_SYSERR;
-        GNUNET_free (allopts);
-        GNUNET_free (lpfx);
-        goto cleanup;
-      }
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  _ ("Malformed configuration. Exiting ...\n"));
+      ret = GNUNET_SYSERR;
+      GNUNET_free (allopts);
+      GNUNET_free (lpfx);
+      goto cleanup;
     }
   }
   GNUNET_free (allopts);
@@ -346,7 +350,7 @@ GNUNET_PROGRAM_run2 (int argc,
     cc.task (cc.task_cls, cc.args, cc.cfgfile, cc.cfg);
   }
   ret = GNUNET_OK;
-  cleanup:
+cleanup:
   GNUNET_CONFIGURATION_destroy (cfg);
   GNUNET_free (cc.cfgfile);
   GNUNET_free (cfg_fn);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]