summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-08 13:57:22 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-08 15:21:06 +0100
commitd310cf3b49d58f192b76ae8698f730e79dac3ec6 (patch)
treead13a8c70877c07e32ab634daf72c9bd2a171ecd /Kernel
parente48566720146e0c843554d2d474d7e5dad03b64d (diff)
downloadserenity-d310cf3b49d58f192b76ae8698f730e79dac3ec6.zip
Kernel: Opening a file with O_TRUNC should update mtime
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp4
1 files changed, 3 insertions, 1 deletions
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<NonnullRefPtr<FileDescription>> 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);
}