From 32b07f7057eac6e3e9774e7256951a953372e6ba Mon Sep 17 00:00:00 2001 From: Fabian Dellwing Date: Mon, 12 Feb 2024 12:50:30 +0100 Subject: [PATCH] Kernel: Make `ftruncate` change `st_ctime` as per spec Previously we only modified `st_mtime` but the spec tells us to do both: https://pubs.opengroup.org/onlinepubs/007908799/xsh/ftruncate.html --- Kernel/FileSystem/InodeFile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp index 1a3b1c56b2..cd429b101b 100644 --- a/Kernel/FileSystem/InodeFile.cpp +++ b/Kernel/FileSystem/InodeFile.cpp @@ -96,7 +96,8 @@ ErrorOr> InodeFile::pseudo_path(OpenFileDescription const ErrorOr InodeFile::truncate(u64 size) { TRY(m_inode->truncate(size)); - TRY(m_inode->update_timestamps({}, {}, kgettimeofday())); + auto truncated_at = kgettimeofday(); + TRY(m_inode->update_timestamps({}, truncated_at, truncated_at)); return {}; }