diff options
| author | Ayke van Laethem <aykevanlaethem@gmail.com> | 2017-12-19 23:47:07 +0100 |
|---|---|---|
| committer | Jeff Epler <jepler@unpythonic.net> | 2018-03-23 09:19:56 -0500 |
| commit | fa55b15ac6a15be0c11123753760324547518a18 (patch) | |
| tree | bff0be89042dc49b776ddba0309e2c0bd0644ef2 /extmod/vfs_fat_file.c | |
| parent | 9ab39eb2d286276edd5dd70612d2d6f6c48b71a0 (diff) | |
extmod/vfs_fat_file: Implement SEEK_CUR for non-zero offset.
CPython doesn't allow SEEK_CUR with non-zero offset for files in text mode,
and uPy inherited this behaviour for both text and binary files. It makes
sense to provide full support for SEEK_CUR of binary-mode files in uPy, and
to do this in a minimal way means also allowing to use SEEK_CUR with
non-zero offsets on text-mode files. That seems to be a fair compromise.
Diffstat (limited to 'extmod/vfs_fat_file.c')
| -rw-r--r-- | extmod/vfs_fat_file.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c index f580184a7..be9c8c792 100644 --- a/extmod/vfs_fat_file.c +++ b/extmod/vfs_fat_file.c @@ -125,11 +125,7 @@ STATIC mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, break; case 1: // SEEK_CUR - if (s->offset != 0) { - *errcode = MP_EOPNOTSUPP; - return MP_STREAM_ERROR; - } - // no-operation + f_lseek(&self->fp, f_tell(&self->fp) + s->offset); break; case 2: // SEEK_END |
