From a7ef3d06f74c8131b04b41cdf902e3c59f61769f Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Sun, 8 Dec 2024 19:43:31 +0100 Subject: vfs: Force truncation even without permissions O_TRUNC as a mode does not seem to imply write permissions but we still wish to truncate the file before giving back a file descriptor. Therefore the kernel can now override any permission checks if it wishes to do a truncation while still using the "ordinary path". --- kernel/cpu/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/cpu') diff --git a/kernel/cpu/syscall.c b/kernel/cpu/syscall.c index 284a80d..a78e63e 100644 --- a/kernel/cpu/syscall.c +++ b/kernel/cpu/syscall.c @@ -152,7 +152,7 @@ int syscall_fstat(int fd, struct stat *buf) { } int syscall_ftruncate(int fd, size_t length) { - return vfs_ftruncate(fd, length); + return vfs_ftruncate(fd, length, 0); } char *syscall_getcwd(char *buf, size_t size) { -- cgit v1.2.3