unix/file: ioctl(): Check that file is open before operations.

This commit is contained in:
Paul Sokolovsky 2016-07-27 00:30:09 +03:00
parent 8fac939889
commit ade36806c8
1 changed files with 1 additions and 0 deletions

View File

@ -105,6 +105,7 @@ STATIC mp_uint_t fdfile_write(mp_obj_t o_in, const void *buf, mp_uint_t size, in
STATIC mp_uint_t fdfile_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_fdfile_t *o = MP_OBJ_TO_PTR(o_in);
check_fd_is_open(o_in);
switch (request) {
case MP_STREAM_SEEK: {
struct mp_stream_seek_t *s = (struct mp_stream_seek_t*)arg;