From 26adfcee3d3ecfa8cc0dfbc2d848d5519850bb1b Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Wed, 12 Mar 2014 20:22:20 +0100 Subject: [PATCH] Only touch if the file does not exists --- kernel/src/vfs/vfs.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/src/vfs/vfs.cpp b/kernel/src/vfs/vfs.cpp index 26d3ab40..624dd584 100644 --- a/kernel/src/vfs/vfs.cpp +++ b/kernel/src/vfs/vfs.cpp @@ -204,7 +204,12 @@ int64_t vfs::open(const char* file_path, size_t flags){ int64_t sub_result; if(flags & std::OPEN_CREATE){ - sub_result = fs.file_system->touch(fs_path); + vfs::file file; + sub_result = fs.file_system->get_file(fs_path, file); + + if(sub_result == std::ERROR_NOT_EXISTS){ + sub_result = fs.file_system->touch(fs_path); + } } else { vfs::file file; sub_result = fs.file_system->get_file(fs_path, file);