From: Tulio A M Mendes Date: Tue, 26 May 2026 05:19:40 +0000 (-0300) Subject: security: remove truncate fallback, return ENOSYS for no backend (Fase 3) X-Git-Url: https://projects.tadryanom.me/?a=commitdiff_plain;h=bef087a566c4e62b201a86e772806d220ef0ae4b;p=AdrOS.git security: remove truncate fallback, return ENOSYS for no backend (Fase 3) --- diff --git a/src/kernel/fs.c b/src/kernel/fs.c index 9bd62a80..94f63019 100644 --- a/src/kernel/fs.c +++ b/src/kernel/fs.c @@ -610,9 +610,8 @@ int vfs_truncate(const char* path, uint32_t length) { if (node->flags != FS_FILE) return -EISDIR; if (node->i_ops && node->i_ops->truncate) return node->i_ops->truncate(node, length); - /* A14: fallback for FS that don't support truncate - just update length */ - node->length = length; - return 0; + /* No truncate backend - return ENOSYS instead of silent fallback */ + return -ENOSYS; } /* A14: Helper for ftruncate - truncate by node instead of path */ @@ -621,9 +620,8 @@ int vfs_truncate_node(fs_node_t* node, uint32_t length) { if (node->flags != FS_FILE) return -EINVAL; if (node->i_ops && node->i_ops->truncate) return node->i_ops->truncate(node, length); - /* Fallback for FS that don't support truncate */ - node->length = length; - return 0; + /* No truncate backend - return ENOSYS instead of silent fallback */ + return -ENOSYS; } /* A07: Helper to check parent directory permissions for mutations */