summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-05-01 15:33:00 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2021-05-01 15:33:00 +0200
commit72b22fd43301548873164dbaa5856a0c2fd19a30 (patch)
treea781ef57b4aa637f85a711213e13fcb1112c9cc0 /src/core/hle/service
parentMerge pull request #6257 from Morph1984/fix-use-after-free-webapplet (diff)
downloadyuzu-72b22fd43301548873164dbaa5856a0c2fd19a30.tar
yuzu-72b22fd43301548873164dbaa5856a0c2fd19a30.tar.gz
yuzu-72b22fd43301548873164dbaa5856a0c2fd19a30.tar.bz2
yuzu-72b22fd43301548873164dbaa5856a0c2fd19a30.tar.lz
yuzu-72b22fd43301548873164dbaa5856a0c2fd19a30.tar.xz
yuzu-72b22fd43301548873164dbaa5856a0c2fd19a30.tar.zst
yuzu-72b22fd43301548873164dbaa5856a0c2fd19a30.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 72ad273b2..67b2b3102 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -55,10 +55,15 @@ std::string VfsDirectoryServiceWrapper::GetName() const {
ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const {
std::string path(Common::FS::SanitizePath(path_));
auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
- // dir can be nullptr if path contains subdirectories, create those prior to creating the file.
if (dir == nullptr) {
- dir = backing->CreateSubdirectory(Common::FS::GetParentPath(path));
+ return FileSys::ERROR_PATH_NOT_FOUND;
+ }
+
+ const auto entry_type = GetEntryType(path);
+ if (entry_type.Code() == RESULT_SUCCESS) {
+ return FileSys::ERROR_PATH_ALREADY_EXISTS;
}
+
auto file = dir->CreateFile(Common::FS::GetFilename(path));
if (file == nullptr) {
// TODO(DarkLordZach): Find a better error code for this