Skip to content

Commit

Permalink
fixed check
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Ramz committed Apr 21, 2020
1 parent 59eef81 commit 56801da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 3 additions & 2 deletions lib/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,9 @@ Binding.prototype.readdir = function(
if (!(dir instanceof Directory)) {
throw new FSError('ENOTDIR', dirpath);
}

this.access(dirpath, parseInt('0002', 8));
if (!dir.canRead()) {
throw new FSError('EACCES', dirpath);
}

let list = dir.list();
if (encoding === 'buffer') {
Expand Down
6 changes: 0 additions & 6 deletions test/lib/fs.readdir.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,4 @@ describe('fs.readdirSync(path)', function() {
fs.readdirSync('denied');
});
});

it('throws when access refused', function() {
assert.throws(function() {
fs.readdirSync('denied');
});
});
});

0 comments on commit 56801da

Please # to comment.