summaryrefslogtreecommitdiff
path: root/lib/internal/fs/utils.js
diff options
context:
space:
mode:
authorKlaus Meinhardt <klaus.meinhardt1@gmail.com>2018-09-11 14:50:50 +0200
committerMichael Dawson <michael_dawson@ca.ibm.com>2018-09-27 15:44:24 -0400
commit83864b3bb0a18bf37548586c66be95be5843e640 (patch)
tree43263efd75b80e885e8b39858e9d0c19a967d73d /lib/internal/fs/utils.js
parent7dae8729aa0a8f6f7aa18295a391ad0f03501e75 (diff)
downloadandroid-node-v8-83864b3bb0a18bf37548586c66be95be5843e640.tar.gz
android-node-v8-83864b3bb0a18bf37548586c66be95be5843e640.tar.bz2
android-node-v8-83864b3bb0a18bf37548586c66be95be5843e640.zip
fs: consistently return symlink type from readdir
Use 'lstat' to determine type of directory entry. This is more consistent with the type returned from the readdir binding. Also use 'path.join' over 'path.resolve' because 'name' is not absolute. PR-URL: https://github.com/nodejs/node/pull/22808 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'lib/internal/fs/utils.js')
-rw-r--r--lib/internal/fs/utils.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js
index 5ee94dae29..c614cb4880 100644
--- a/lib/internal/fs/utils.js
+++ b/lib/internal/fs/utils.js
@@ -131,7 +131,7 @@ function getDirents(path, [names, types], callback) {
const name = names[i];
const idx = i;
toFinish++;
- lazyLoadFs().stat(pathModule.resolve(path, name), (err, stats) => {
+ lazyLoadFs().lstat(pathModule.join(path, name), (err, stats) => {
if (err) {
callback(err);
return;
@@ -154,7 +154,7 @@ function getDirents(path, [names, types], callback) {
const type = types[i];
if (type === UV_DIRENT_UNKNOWN) {
const name = names[i];
- const stats = lazyLoadFs().statSync(pathModule.resolve(path, name));
+ const stats = lazyLoadFs().lstatSync(pathModule.join(path, name));
names[i] = new DirentFromStats(name, stats);
} else {
names[i] = new Dirent(names[i], types[i]);