From: Ivan Grokhotkov Date: Mon, 7 Nov 2016 06:26:21 +0000 (+0800) Subject: vfs: check error code returned by FS driver open function X-Git-Tag: v1.0~70^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13b3c916f306ab97877c5331cc9a15a6296616f7;p=esp-idf vfs: check error code returned by FS driver open function Fixes https://github.com/espressif/esp-idf/issues/78 --- diff --git a/components/vfs/vfs.c b/components/vfs/vfs.c index bf26968ff7..b60c60a818 100644 --- a/components/vfs/vfs.c +++ b/components/vfs/vfs.c @@ -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); int ret; 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); }