From d7d96907cfbb8bc64703ed82a960704da8112aaf Mon Sep 17 00:00:00 2001 From: Oliver Friedmann Date: Fri, 21 Aug 2015 19:30:04 -0400 Subject: [PATCH] This fixes an issue with caching when the creation of a subdirectory within the cache is aborted because a common cached parent directory already exists. --- src/s3fs_util.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/s3fs_util.cpp b/src/s3fs_util.cpp index 82f05d2..3cb7dab 100644 --- a/src/s3fs_util.cpp +++ b/src/s3fs_util.cpp @@ -549,14 +549,12 @@ int mkdirp(const string& path, mode_t mode) string base; string component; stringstream ss(path); + int result = 0; while (getline(ss, component, '/')) { base += "/" + component; - int result = mkdir(base.c_str(), mode); - if(0 != result){ - return result; - } + result = mkdir(base.c_str(), mode); } - return 0; + return result; } bool delete_files_in_dir(const char* dir, bool is_remove_own)