gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: config: resolve realpath of base dir, no


From: gnunet
Subject: [gnunet] branch master updated: config: resolve realpath of base dir, not config
Date: Mon, 26 Jul 2021 20:03:03 +0200

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

dold pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new cda72d5c4 config: resolve realpath of base dir, not config
cda72d5c4 is described below

commit cda72d5c4cdde29baedb57ed07be7779b3cd46fc
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Jul 26 19:59:29 2021 +0200

    config: resolve realpath of base dir, not config
---
 src/util/configuration.c | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/util/configuration.c b/src/util/configuration.c
index 8ca3681af..fd1ab2ecb 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -309,7 +309,6 @@ GNUNET_CONFIGURATION_deserialize (struct 
GNUNET_CONFIGURATION_Handle *cfg,
                           strlen ("@INLINE@ ")))
     {
       char *inline_path;
-      char *inline_realpath;
 
       if (NULL == basedir)
       {
@@ -323,32 +322,35 @@ GNUNET_CONFIGURATION_deserialize (struct 
GNUNET_CONFIGURATION_Handle *cfg,
       if ('/' == *value)
         inline_path = GNUNET_strdup (value);
       else
+      {
+        /* We compute the canonical, absolute path first,
+           so that relative imports resolve properly with symlinked
+           config files.  */
+        char *basedir_realpath;
+
+        basedir_realpath = realpath (basedir,
+                                     NULL);
+        if (NULL == basedir_realpath)
+        {
+          /* Couldn't even resolve path of base dir. */
+          GNUNET_break (0);
+          ret = GNUNET_SYSERR;       /* failed to parse included config */
+          break;
+        }
         GNUNET_asprintf (&inline_path,
                          "%s/%s",
-                         basedir,
+                         basedir_realpath,
                          value);
-      /* We compute the canonical, absolute path first,
-         so that relative imports resolve properly with symlinked
-         config files.  */
-      inline_realpath = realpath (inline_path,
-                                  NULL);
-      GNUNET_free (inline_path);
-      if (NULL == inline_realpath)
-      {
-        /* Couldn't even resolve path of included file. */
-        GNUNET_break (0);
-        ret = GNUNET_SYSERR;       /* failed to parse included config */
-        break;
       }
       if (GNUNET_OK !=
           GNUNET_CONFIGURATION_parse (cfg,
-                                      inline_realpath))
+                                      inline_path))
       {
-        GNUNET_free (inline_realpath);
+        GNUNET_free (inline_path);
         ret = GNUNET_SYSERR;       /* failed to parse included config */
         break;
       }
-      GNUNET_free (inline_realpath);
+      GNUNET_free (inline_path);
       continue;
     }
     if (('[' == line[0]) && (']' == line[line_size - 1]))

-- 
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]