64d3793190
The error handling was already in place. The reason it was page faulting is that, on failure, the function exits as soon as it encounters an `Err` variant. When that happens, the DSO object for which the dependency was being loaded is dropped. Dropping it calls `munmap` to unload the executable and also runs the functions in `.fini`. However, `run_fini` should only be called if the `DSO` is being unloaded after it has been successfully loaded (i.e. all dependencies were satisfied and all init functions had run). Closes #1599 Signed-off-by: Anhad Singh <andypython@protonmail.com>