summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-08-31 00:17:35 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-08-31 00:20:08 +0300
commit696eee947539d6394a8f14efd84e20934c1e39bb (patch)
tree54cf91098b6aa53a06d8ba0e740a6f4d8dfd94d9
parenta9058bf2944db20f5e2377a6a38c37a46d3d6aa0 (diff)
downloadmicropython-696eee947539d6394a8f14efd84e20934c1e39bb.tar.gz
micropython-696eee947539d6394a8f14efd84e20934c1e39bb.zip
modffi: dlsym() doesn't set errno, so use ENOENT for OSError.
This may be a bit confusing, as ENOENT is often rendered as "No such file or directory", but any other code would be only more confusing.
-rw-r--r--unix/modffi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/unix/modffi.c b/unix/modffi.c
index b268bf9e08..253672390c 100644
--- a/unix/modffi.c
+++ b/unix/modffi.c
@@ -214,7 +214,7 @@ STATIC mp_obj_t ffimod_func(mp_uint_t n_args, const mp_obj_t *args) {
void *sym = dlsym(self->handle, symname);
if (sym == NULL) {
- nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno)));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOENT)));
}
return make_func(args[1], sym, args[3]);
}
@@ -277,7 +277,7 @@ STATIC mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symna
void *sym = dlsym(self->handle, symname);
if (sym == NULL) {
- nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno)));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOENT)));
}
mp_obj_ffivar_t *o = m_new_obj(mp_obj_ffivar_t);
o->base.type = &ffivar_type;
@@ -294,7 +294,7 @@ STATIC mp_obj_t ffimod_addr(mp_obj_t self_in, mp_obj_t symname_in) {
void *sym = dlsym(self->handle, symname);
if (sym == NULL) {
- nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno)));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOENT)));
}
return mp_obj_new_int((mp_int_t)sym);
}