Commit 696eee94 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

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.
parent a9058bf2
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment