From 18019a3b89203276146b80b8355b51d44b2ed9c0 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Fri, 21 Feb 2014 18:48:55 +0100 Subject: [PATCH] settings: Use thread-safe dirname(3) --- src/libstrongswan/utils/settings.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libstrongswan/utils/settings.c b/src/libstrongswan/utils/settings.c index 27a665d16a..490490a1e8 100644 --- a/src/libstrongswan/utils/settings.c +++ b/src/libstrongswan/utils/settings.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -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 { -- 2.47.2