diff --git a/lib/fs.js b/lib/fs.js index 54e6b4ac0d2536..6f7a3cf2513bd8 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1550,7 +1550,7 @@ fs.realpathSync = function realpathSync(p, cache) { } } if (linkTarget === null) { - fs.statSync(base); + fs.accessSync(base, fs.F_OK); // Throws ELOOP on cyclic links. linkTarget = fs.readlinkSync(base); } resolvedLink = pathModule.resolve(previous, linkTarget);