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/fs/vfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/fs/vfs.h') diff --git a/kernel/fs/vfs.h b/kernel/fs/vfs.h index cb1c885..98220d3 100644 --- a/kernel/fs/vfs.h +++ b/kernel/fs/vfs.h @@ -86,7 +86,7 @@ vfs_inode_t *vfs_internal_open(const char *file); int vfs_mkdir(const char *path, int mode); int vfs_create_fd(int flags, int mode, int is_tty, vfs_inode_t *inode, vfs_fd_t **fd); -int vfs_ftruncate(int fd, size_t length); +int vfs_ftruncate(int fd, size_t length, int force_truncate); int vfs_chdir(const char *path); int vfs_fstat(int fd, struct stat *buf); vfs_inode_t *vfs_create_inode( -- cgit v1.2.3