diff options
Diffstat (limited to 'lldb/source/Host/posix/FileSystem.cpp')
-rw-r--r-- | lldb/source/Host/posix/FileSystem.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/lldb/source/Host/posix/FileSystem.cpp b/lldb/source/Host/posix/FileSystem.cpp index 1f2e7db0e1e..81a5ee9b54e 100644 --- a/lldb/source/Host/posix/FileSystem.cpp +++ b/lldb/source/Host/posix/FileSystem.cpp @@ -54,30 +54,32 @@ FileSystem::MakeDirectory(const FileSpec &file_spec, uint32_t file_permissions) switch (error.GetError()) { case ENOENT: - { - // Parent directory doesn't exist, so lets make it if we can - // Make the parent directory and try again - FileSpec parent_file_spec{file_spec.GetDirectory().GetCString(), false}; - error = MakeDirectory(parent_file_spec, file_permissions); - if (error.Fail()) - return error; - // Try and make the directory again now that the parent directory was made successfully - if (::mkdir(file_spec.GetCString(), file_permissions) == -1) { - error.SetErrorToErrno(); + // Parent directory doesn't exist, so lets make it if we can + // Make the parent directory and try again + FileSpec parent_file_spec{file_spec.GetDirectory().GetCString(), false}; + error = MakeDirectory(parent_file_spec, file_permissions); + if (error.Fail()) + return error; + // Try and make the directory again now that the parent directory was made successfully + if (::mkdir(file_spec.GetCString(), file_permissions) == -1) + { + error.SetErrorToErrno(); + } return error; } - } + break; case EEXIST: - { - if (file_spec.IsDirectory()) - return Error{}; // It is a directory and it already exists - } + { + if (file_spec.IsDirectory()) + return Error(); // It is a directory and it already exists + } + break; } } return error; } - return Error{"empty path"}; + return Error("empty path"); } Error |