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
This commit is contained in:
Fabian Dellwing 2024-02-12 12:50:30 +01:00 committed by Jelle Raaijmakers
parent 751185cb76
commit 32b07f7057
Notes: sideshowbarker 2024-07-17 07:19:27 +09:00

View File

@ -96,7 +96,8 @@ ErrorOr<NonnullOwnPtr<KString>> InodeFile::pseudo_path(OpenFileDescription const
ErrorOr<void> 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 {};
}