Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upgrade to chef_certgen NIF Without an upgrade function, we see the following error report when #2

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion c_src/chef_certgen.c
Expand Up @@ -73,6 +73,7 @@ static const EVP_MD *digest;

/* NIF interface declarations */
static int load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info);
static int upgrade(ErlNifEnv* env, void** priv_data, void** old_priv_data, ERL_NIF_TERM load_info);

static int load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info)
{
Expand All @@ -92,6 +93,13 @@ static int load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info)
return 0;
}

static int upgrade(ErlNifEnv* env, void** priv_data, void** old_priv_data,
ERL_NIF_TERM load_info)
{
load(env, priv_data, load_info);
return 0;
}

static ERL_NIF_TERM rsa_generate_key_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
ERL_NIF_TERM ret;
Expand Down Expand Up @@ -511,4 +519,4 @@ static ERL_NIF_TERM x509_make_cert_nif(ErlNifEnv* env, int argc, const ERL_NIF_T
return ret;
}

ERL_NIF_INIT(chef_certgen,nif_funcs,load,NULL,NULL,NULL)
ERL_NIF_INIT(chef_certgen,nif_funcs,load,NULL,upgrade,NULL)