diff options
author | Damien George <damien@micropython.org> | 2021-02-11 22:53:36 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-02-11 22:54:41 +1100 |
commit | 26b4ef4c46520f595f39d53bbea7f247c9467370 (patch) | |
tree | 281d554ed78f489b3e38ed02638288e638b5f9c0 /extmod/vfs_posix_file.c | |
parent | c7aaee2b2ba0cb19d3b3deb6092e0bfe55d79052 (diff) |
extmod/vfs_posix_file: Allow closing an already closed file.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/vfs_posix_file.c')
-rw-r--r-- | extmod/vfs_posix_file.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/extmod/vfs_posix_file.c b/extmod/vfs_posix_file.c index 264764b4e..f3eac98ce 100644 --- a/extmod/vfs_posix_file.c +++ b/extmod/vfs_posix_file.c @@ -163,7 +163,11 @@ STATIC mp_uint_t vfs_posix_file_write(mp_obj_t o_in, const void *buf, mp_uint_t STATIC mp_uint_t vfs_posix_file_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) { mp_obj_vfs_posix_file_t *o = MP_OBJ_TO_PTR(o_in); - check_fd_is_open(o); + + if (request != MP_STREAM_CLOSE) { + check_fd_is_open(o); + } + switch (request) { case MP_STREAM_FLUSH: { int ret; |