Skip to content

Commit a6b3b55

Browse files
committed
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.
1 parent c6f655c commit a6b3b55

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

features/filesystem/Dir.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ int Dir::open(FileSystem *fs, const char *path)
4343
return -EINVAL;
4444
}
4545

46-
_fs = fs;
47-
return _fs->dir_open(&_dir, path);
46+
int err = fs->dir_open(&_dir, path);
47+
if (!err) {
48+
_fs = fs;
49+
}
50+
51+
return err;
4852
}
4953

5054
int Dir::close()

0 commit comments

Comments
 (0)