From e48566720146e0c843554d2d474d7e5dad03b64d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 8 Jan 2020 13:56:49 +0100 Subject: [PATCH] Kernel: ftruncate() should update mtime --- Kernel/FileSystem/InodeFile.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp index f3449498a8..852a450401 100644 --- a/Kernel/FileSystem/InodeFile.cpp +++ b/Kernel/FileSystem/InodeFile.cpp @@ -50,7 +50,13 @@ String InodeFile::absolute_path(const FileDescription& description) const KResult InodeFile::truncate(off_t size) { - return m_inode->truncate(size); + auto truncate_result = m_inode->truncate(size); + if (truncate_result.is_error()) + return truncate_result; + int mtime_result = m_inode->set_mtime(kgettimeofday().tv_sec); + if (mtime_result != 0) + return KResult(mtime_result); + return KSuccess; } KResult InodeFile::chown(uid_t uid, gid_t gid)