summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/unix/modmachine.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ports/unix/modmachine.c b/ports/unix/modmachine.c
index 48dddec0a..e2c44f94c 100644
--- a/ports/unix/modmachine.c
+++ b/ports/unix/modmachine.c
@@ -57,10 +57,11 @@ uintptr_t mod_machine_mem_get_addr(mp_obj_t addr_o, uint align) {
static uintptr_t last_base = (uintptr_t)-1;
static uintptr_t map_page;
if (!fd) {
- fd = open("/dev/mem", O_RDWR | O_SYNC);
- if (fd == -1) {
+ int _fd = open("/dev/mem", O_RDWR | O_SYNC);
+ if (_fd == -1) {
mp_raise_OSError(errno);
}
+ fd = _fd;
}
uintptr_t cur_base = addr & ~MICROPY_PAGE_MASK;