fs: check access for unlinkat()

This commit is contained in:
2021-04-30 01:15:20 +03:00
parent 12ef80d290
commit abec971f7c
+6
View File
@@ -341,6 +341,12 @@ int vfs_unlinkat(struct vfs_ioctx *ctx, struct vnode *at, const char *pathname,
} }
} }
_assert(node->parent != NULL);
// Must have write access to remove entries
if ((res = vfs_access_node(ctx, node->parent, W_OK)) != 0) {
return res;
}
if ((res = node->op->unlink(node)) != 0) { if ((res = node->op->unlink(node)) != 0) {
return res; return res;
} }