From: Tobias Brunner Date: Fri, 21 Feb 2014 17:48:55 +0000 (+0100) Subject: settings: Use thread-safe dirname(3) X-Git-Tag: 5.1.2~9^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18019a3b89203276146b80b8355b51d44b2ed9c0;p=thirdparty%2Fstrongswan.git settings: Use thread-safe dirname(3) --- 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 {