diff options
author | Doug Hogan <[email protected]> | 2019-01-03 21:12:29 -0800 |
---|---|---|
committer | Doug Hogan <[email protected]> | 2019-01-08 01:11:57 -0800 |
commit | db48a4b67a5397ee9f4d910a3903159b1c7c79fd (patch) | |
tree | 6c47ab88c8ee962a64934465782ae965c0564c1b /lib/crypto/c_src/engine.c | |
parent | b70c3ae28e9cad0ca19c7b8c427cfb5b70d8e3f2 (diff) | |
download | otp-db48a4b67a5397ee9f4d910a3903159b1c7c79fd.tar.gz otp-db48a4b67a5397ee9f4d910a3903159b1c7c79fd.tar.bz2 otp-db48a4b67a5397ee9f4d910a3903159b1c7c79fd.zip |
Revamp engine_remove_nif()
Diffstat (limited to 'lib/crypto/c_src/engine.c')
-rw-r--r-- | lib/crypto/c_src/engine.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/crypto/c_src/engine.c b/lib/crypto/c_src/engine.c index b3a87cdd3d..76f7503968 100644 --- a/lib/crypto/c_src/engine.c +++ b/lib/crypto/c_src/engine.c @@ -355,16 +355,21 @@ ERL_NIF_TERM engine_remove_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv struct engine_ctx *ctx; // Get Engine - if (!enif_get_resource(env, argv[0], engine_ctx_rtype, (void**)&ctx)) { - PRINTF_ERR0("engine_remove_nif Leaved: Parameter not an engine resource object"); - return enif_make_badarg(env); - } + if (argc != 1) + goto bad_arg; + if (!enif_get_resource(env, argv[0], engine_ctx_rtype, (void**)&ctx)) + goto bad_arg; + + if (!ENGINE_remove(ctx->engine)) + goto failed; - if (!ENGINE_remove(ctx->engine)) { - PRINTF_ERR0("engine_remove_nif Leaved: {error, remove_engine_failed}"); - return enif_make_tuple2(env, atom_error, atom_remove_engine_failed); - } return atom_ok; + + bad_arg: + return enif_make_badarg(env); + + failed: + return enif_make_tuple2(env, atom_error, atom_remove_engine_failed); #else return atom_notsup; #endif |