]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
settings: Use thread-safe dirname(3)
authorTobias Brunner <tobias@strongswan.org>
Fri, 21 Feb 2014 17:48:55 +0000 (18:48 +0100)
committerTobias Brunner <tobias@strongswan.org>
Mon, 24 Feb 2014 11:04:11 +0000 (12:04 +0100)
src/libstrongswan/utils/settings.c

index 27a665d16abfce5fc8c3165d4385c010c535812f..490490a1e8a62d2c59354cf25a2fb16c315ef1ba 100644 (file)
@@ -20,7 +20,6 @@
 #include <stdio.h>
 #include <errno.h>
 #include <limits.h>
-#include <libgen.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -1302,15 +1301,14 @@ static bool parse_files(linked_list_t *contents, char *file, int level,
        }
        else
        {       /* base relative paths to the directory of the current file */
-               char *path = strdup(file);
-               char *dir = dirname(path);
+               char *dir = path_dirname(file);
                if (snprintf(pat, sizeof(pat), "%s/%s", dir, pattern) >= sizeof(pat))
                {
                        DBG1(DBG_LIB, "include pattern too long, ignored");
-                       free(path);
+                       free(dir);
                        return TRUE;
                }
-               free(path);
+               free(dir);
        }
 #ifdef HAVE_GLOB_H
        {