summaryrefslogtreecommitdiff
path: root/extmod/vfs_reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/vfs_reader.c')
-rw-r--r--extmod/vfs_reader.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/extmod/vfs_reader.c b/extmod/vfs_reader.c
index db13ce3c3..d3904c5c5 100644
--- a/extmod/vfs_reader.c
+++ b/extmod/vfs_reader.c
@@ -71,8 +71,11 @@ STATIC void mp_reader_vfs_close(void *data) {
void mp_reader_new_file(mp_reader_t *reader, const char *filename) {
mp_reader_vfs_t *rf = m_new_obj(mp_reader_vfs_t);
- mp_obj_t arg = mp_obj_new_str(filename, strlen(filename));
- rf->file = mp_vfs_open(1, &arg, (mp_map_t *)&mp_const_empty_map);
+ mp_obj_t args[2] = {
+ mp_obj_new_str(filename, strlen(filename)),
+ MP_OBJ_NEW_QSTR(MP_QSTR_rb),
+ };
+ rf->file = mp_vfs_open(MP_ARRAY_SIZE(args), &args[0], (mp_map_t *)&mp_const_empty_map);
int errcode;
rf->len = mp_stream_rw(rf->file, rf->buf, sizeof(rf->buf), &errcode, MP_STREAM_RW_READ | MP_STREAM_RW_ONCE);
if (errcode != 0) {