vfs: check error code returned by FS driver open function
Fixes https://github.com/espressif/esp-idf/issues/78
This commit is contained in:
parent
cdebf24954
commit
13b3c916f3
1 changed files with 4 additions and 0 deletions
|
@ -151,6 +151,10 @@ int esp_vfs_open(struct _reent *r, const char * path, int flags, int mode)
|
||||||
const char* path_within_vfs = translate_path(vfs, path);
|
const char* path_within_vfs = translate_path(vfs, path);
|
||||||
int ret;
|
int ret;
|
||||||
CHECK_AND_CALL(ret, r, vfs, open, path_within_vfs, flags, mode);
|
CHECK_AND_CALL(ret, r, vfs, open, path_within_vfs, flags, mode);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
assert(ret >= vfs->vfs.fd_offset);
|
||||||
return ret - vfs->vfs.fd_offset + (vfs->offset << VFS_INDEX_S);
|
return ret - vfs->vfs.fd_offset + (vfs->offset << VFS_INDEX_S);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue