1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 10:54:57 +00:00

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

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 {};
}