summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-06 16:36:58 +0200
committerDavid Robillard <d@drobilla.net>2020-08-06 17:34:42 +0200
commitdb8a69a52e6dd5c9529537fb1e17489ee883e48c (patch)
tree52e35642e36e1a3142d7d24c0cdb610b31a248e2
parent61e85b7553640201d40c31aaa09f5b6184b658ee (diff)
downloadlilv-db8a69a52e6dd5c9529537fb1e17489ee883e48c.tar.gz
lilv-db8a69a52e6dd5c9529537fb1e17489ee883e48c.tar.bz2
lilv-db8a69a52e6dd5c9529537fb1e17489ee883e48c.zip
Fix lilv_create_directories() error handling when path is a file
-rw-r--r--src/filesystem.c3
1 files changed, 2 insertions, 1 deletions
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;
}