Hello,

With commit 77339944c (patch written by me), partial ProjectData
structures could be used to allow programs to be executed without
providing some files.

Unfortunately there's a bug that for some reason I managed to trigger
only now: under some conditions, using the -c flag generates an error
and aborts the execution.

The application that triggered it is a program that normally doesn't
require a configuration file, but can accept one to override the default
values if the user wishes to.

The attached patch should fix the issue.

Thanks,
A.V.

>From 098b884da641e141f1972649ff155cf6bc306e03 Mon Sep 17 00:00:00 2001
From: Alessio Vanni <[email protected]>
Date: Mon, 26 Oct 2020 01:26:27 +0100
Subject: [PATCH] - fix '-c' in applications without base config

---
 src/util/configuration_loader.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/util/configuration_loader.c b/src/util/configuration_loader.c
index 51af24a9f..a59477b25 100644
--- a/src/util/configuration_loader.c
+++ b/src/util/configuration_loader.c
@@ -63,14 +63,16 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
     GNUNET_free (ipath);
   }
 
-  if (GNUNET_SYSERR ==
-      GNUNET_CONFIGURATION_load_from (cfg,
-                                      baseconfig))
+  char *dname = GNUNET_STRINGS_filename_expand (baseconfig);
+  GNUNET_free (baseconfig);
+
+  if (GNUNET_YES == GNUNET_DISK_directory_test (dname, GNUNET_YES) &&
+      GNUNET_SYSERR == GNUNET_CONFIGURATION_load_from (cfg, dname))
   {
-    GNUNET_free (baseconfig);
+    GNUNET_free (dname);
     return GNUNET_SYSERR;       /* no configuration at all found */
   }
-  GNUNET_free (baseconfig);
+  GNUNET_free (dname);
   if ((NULL != filename) &&
       (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, filename)))
   {
-- 
2.26.2

Reply via email to