diff options
author | Sverker Eriksson <[email protected]> | 2011-02-04 12:07:54 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2011-02-18 15:12:51 +0100 |
commit | 35b85a49dc4ea6febc4cdb4a7024bb7a9aab72be (patch) | |
tree | 26b216b9d7614d9daa49cb61313e16c311ddb000 /erts/emulator/beam/erl_nif.c | |
parent | 2e0181837dbe96a4ce738a339a9a02a6e26746f8 (diff) | |
download | otp-35b85a49dc4ea6febc4cdb4a7024bb7a9aab72be.tar.gz otp-35b85a49dc4ea6febc4cdb4a7024bb7a9aab72be.tar.bz2 otp-35b85a49dc4ea6febc4cdb4a7024bb7a9aab72be.zip |
Refuse to load NIF library on wrong VM variant (halfword/fullword)
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 2f9295e624..135c6b0ccc 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -1478,7 +1478,13 @@ BIF_RETTYPE load_nif_2(BIF_ALIST_2) ret = load_nif_error(BIF_P, bad_lib, "Library version (%d.%d) not compatible (with %d.%d).", entry->major, entry->minor, ERL_NIF_MAJOR_VERSION, ERL_NIF_MINOR_VERSION); - } + } + else if (entry->minor >= 1 + && sys_strcmp(entry->vm_variant, ERL_NIF_VM_VARIANT) != 0) { + ret = load_nif_error(BIF_P, bad_lib, "Library (%s) not compiled for " + "this vm variant (%s).", + entry->vm_variant, ERL_NIF_VM_VARIANT); + } else if (!erts_is_atom_str((char*)entry->name, mod_atom)) { ret = load_nif_error(BIF_P, bad_lib, "Library module name '%s' does not" " match calling module '%T'", entry->name, mod_atom); |