Skip to content

Commit 5a01858

Browse files
Merge pull request #5183 from geky/fix-dir-open-failures
fs: Fix dir open during failure condition
2 parents c06368a + a6b3b55 commit 5a01858

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)