diff options
author | Doug Hogan <[email protected]> | 2019-01-08 00:27:31 -0800 |
---|---|---|
committer | Doug Hogan <[email protected]> | 2019-01-08 01:11:57 -0800 |
commit | 882a23aef3f2fe2dffbd0e69a780010f8deebb76 (patch) | |
tree | b268029790c4c15ccc5360713b866e578eea8260 /lib/crypto | |
parent | 8b2e00ca9c9a92b1088ddeb75a3764bf198ab19f (diff) | |
download | otp-882a23aef3f2fe2dffbd0e69a780010f8deebb76.tar.gz otp-882a23aef3f2fe2dffbd0e69a780010f8deebb76.tar.bz2 otp-882a23aef3f2fe2dffbd0e69a780010f8deebb76.zip |
Revamp engine_finish_nif()
Diffstat (limited to 'lib/crypto')
-rw-r--r-- | lib/crypto/c_src/engine.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/crypto/c_src/engine.c b/lib/crypto/c_src/engine.c index 9a3793180d..fb28808cb5 100644 --- a/lib/crypto/c_src/engine.c +++ b/lib/crypto/c_src/engine.c @@ -217,13 +217,19 @@ ERL_NIF_TERM engine_finish_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_finish_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; - ENGINE_finish(ctx->engine); + if (!ENGINE_finish(ctx->engine)) + goto err; return atom_ok; + + bad_arg: + err: + return enif_make_badarg(env); + #else return atom_notsup; #endif |