Skip to content

Commit e485667

Browse files
committed
Kernel: ftruncate() should update mtime
1 parent 1f6c624 commit e485667

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Kernel/FileSystem/InodeFile.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ String InodeFile::absolute_path(const FileDescription& description) const
5050

5151
KResult InodeFile::truncate(off_t size)
5252
{
53-
return m_inode->truncate(size);
53+
auto truncate_result = m_inode->truncate(size);
54+
if (truncate_result.is_error())
55+
return truncate_result;
56+
int mtime_result = m_inode->set_mtime(kgettimeofday().tv_sec);
57+
if (mtime_result != 0)
58+
return KResult(mtime_result);
59+
return KSuccess;
5460
}
5561

5662
KResult InodeFile::chown(uid_t uid, gid_t gid)

0 commit comments

Comments
 (0)