diff options
author | Andreas Kling <awesomekling@gmail.com> | 2020-01-08 13:57:22 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-08 15:21:06 +0100 |
commit | d310cf3b49d58f192b76ae8698f730e79dac3ec6 (patch) | |
tree | ad13a8c70877c07e32ab634daf72c9bd2a171ecd /Kernel/FileSystem | |
parent | e48566720146e0c843554d2d474d7e5dad03b64d (diff) | |
download | serenity-d310cf3b49d58f192b76ae8698f730e79dac3ec6.zip |
Kernel: Opening a file with O_TRUNC should update mtime
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/VirtualFileSystem.cpp | 4 |
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); } |