fs: Fix dir open during failure condition

Should leave the Dir in an openable state, currently does not
since it thinks it's in use by the fs it failed to open on.
pull/5183/head
Christopher Haster 2017-09-22 18:04:31 -05:00
parent c6f655c02e
commit a6b3b55eb9
1 changed files with 6 additions and 2 deletions

View File

@ -43,8 +43,12 @@ int Dir::open(FileSystem *fs, const char *path)
return -EINVAL;
}
_fs = fs;
return _fs->dir_open(&_dir, path);
int err = fs->dir_open(&_dir, path);
if (!err) {
_fs = fs;
}
return err;
}
int Dir::close()