Skip to content

fs: fix misplaced errors in fs.symlinkSync

The ctx.error is supposed to be handled in fs.readlinkSync, but was handled in fs.symlinkSync by mistake.

Also fix the error number check in readlink to be consistent with SYNC_CALL.

Refs: https://github.com/nodejs/node/pull/18348

This is an oversight of https://github.com/nodejs/node/pull/18348, the error handling was supposed to be in fs.readlinkSync instead of fs.symlinkSync. I couldn't come up with a test because these errors cannot be triggered easily:

https://github.com/nodejs/node/blob/1286923cc05e3e7a726fc682be54212ccfc66812/src/string_bytes.cc#L41-L51

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

fs

Merge request reports

Loading