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 20, 2020
1 parent 2aefaf3 commit a442e79
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
Expand Up @@ -953,8 +953,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
Expand Up @@ -244,10 +244,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 a442e79

Please sign in to comment.