From d310cf3b49d58f192b76ae8698f730e79dac3ec6 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 8 Jan 2020 13:57:22 +0100 Subject: Kernel: Opening a file with O_TRUNC should update mtime --- Kernel/FileSystem/VirtualFileSystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Kernel') diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index 2578dd4b79..0c14abb888 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -238,8 +238,10 @@ KResultOr> VFS::open(StringView path, int options descriptor_or_error.value()->set_original_inode({}, inode); return descriptor_or_error; } - if (should_truncate_file) + if (should_truncate_file) { inode.truncate(0); + inode.set_mtime(kgettimeofday().tv_sec); + } return FileDescription::create(custody); } -- cgit v1.2.3