From db8a69a52e6dd5c9529537fb1e17489ee883e48c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 6 Aug 2020 16:36:58 +0200 Subject: Fix lilv_create_directories() error handling when path is a file --- src/filesystem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/filesystem.c b/src/filesystem.c index 957629b..0d840ec 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -400,7 +400,8 @@ lilv_create_directories(const char* dir_path) const char c = path[i]; if (c == LILV_DIR_SEP[0] || c == '/' || c == '\0') { path[i] = '\0'; - if (mkdir(path, 0755) && errno != EEXIST) { + if (mkdir(path, 0755) && + (errno != EEXIST || !lilv_is_directory(path))) { free(path); return errno; } -- cgit v1.2.1