Unverified Commit 7864c536 authored by Anna Henningsen's avatar Anna Henningsen
Browse files

fs: unset FileHandle fd after close

- Do not set the fd as a property on the native object.
- Use the already-existent `GetFD()` method to pass the
  fd from C++ to JS.
- Cache the fd in JS to avoid repeated accesses to the
  C++ getter.
- Set the fd to `-1` after close, thus reliably making
  subsequent calls using the `FileHandle` return `EBADF`.

Fixes: https://github.com/nodejs/node/issues/31361

PR-URL: https://github.com/nodejs/node/pull/31389


Reviewed-By: default avatarRichard Lau <riclau@uk.ibm.com>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarMinwoo Jung <nodecorelab@gmail.com>
Reviewed-By: default avatarDavid Carlier <devnexen@gmail.com>
Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
parent cc0748f5
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment