Skip to content

Commit 72d04a6

Browse files
jasnellnodejs-github-bot
authored andcommitted
fs: check permissions once in bindings with async and sync paths
Eleven fs bindings (stat, statfs, link, rename, unlink, realpath, readdir, copyFile, chown, lchown, mkdtemp) repeated every permission check in both the asynchronous and the synchronous branch, differing only in whether the denial is reported through the request or thrown. Obtain the request wrap up front with a new GetAsyncReqWrap() helper and perform each check once with FS_THROW_IF_INSUFFICIENT_PERMISSIONS(), which picks the reporting style based on whether the call is async. How permission denials are reported is unchanged. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #67497 Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent f04f249 commit 72d04a6

1 file changed

Lines changed: 131 additions & 161 deletions

File tree

0 commit comments

Comments
 (0)