Skip to content

Commit 864a234

Browse files
authored
[WasmFS] Update ctime in chmod (#16974)
Any metadata update should update ctime according to the docs, and we have a test that verifies it. (The test is not enabled yet as it depends on 2 other PRs before I can do that.)
1 parent c175235 commit 864a234

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

system/lib/wasmfs/syscalls.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,10 @@ int __syscall_fchmodat(int dirfd, intptr_t path, int mode, ...) {
10411041
if (auto err = parsed.getError()) {
10421042
return err;
10431043
}
1044-
parsed.getFile()->locked().setMode(mode);
1044+
auto lockedFile = parsed.getFile()->locked();
1045+
lockedFile.setMode(mode);
1046+
// On POSIX, ctime is updated on metadata changes, like chmod.
1047+
lockedFile.setCTime(time(NULL));
10451048
return 0;
10461049
}
10471050

0 commit comments

Comments
 (0)