Fix for readdir and non-dir paths

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-08-20 15:47:14 -04:00
parent 4bba2512b0
commit 057b43ae02
1 changed files with 2 additions and 0 deletions

View File

@ -1085,6 +1085,8 @@ function read_directory(context, path, callback) {
function read_directory_data(error, result) { function read_directory_data(error, result) {
if(error) { if(error) {
callback(error); callback(error);
} else if(result.mode !== MODE_DIRECTORY) {
callback(new Errors.ENOTDIR(null, path));
} else { } else {
directoryNode = result; directoryNode = result;
context.getObject(directoryNode.data, handle_directory_data); context.getObject(directoryNode.data, handle_directory_data);