X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgears%2Fext_env_inject.c;h=96a935c8dfe90f834ee2aedd1d4a0c6005c0b1d0;hb=495d40c7d02054399e118be6a10b0096c938d232;hp=4988dcf24e0883689f4669c7188bc12c081dc397;hpb=7229981629c6baa0afb61cc99cfcf6dd029c9c93;p=palacios.git diff --git a/palacios/src/gears/ext_env_inject.c b/palacios/src/gears/ext_env_inject.c index 4988dcf..96a935c 100644 --- a/palacios/src/gears/ext_env_inject.c +++ b/palacios/src/gears/ext_env_inject.c @@ -38,13 +38,13 @@ static int v3_env_inject_handler (struct guest_info * core, void * priv_data) { struct v3_env_inject_info * inject = (struct v3_env_inject_info*)priv_data; for (; i < inject->num_env_vars; i++) { - PrintDebug("Envvar[%d]: %s\n", i, inject->env_vars[i]); + PrintDebug(core->vm_info, core, "Envvar[%d]: %s\n", i, inject->env_vars[i]); } int ret = v3_inject_strings(core, (const char**)NULL, (const char**)inject->env_vars, 0, inject->num_env_vars); if (ret == -1) { - PrintDebug("Error injecting strings in v3_env_inject_handler\n"); + PrintDebug(core->vm_info, core, "Error injecting strings in v3_env_inject_handler\n"); return -1; } @@ -75,6 +75,12 @@ int v3_insert_env_inject (void * ginfo, char ** strings, int num_strings, char * struct v3_env_injects * injects = &env_injects; struct v3_env_inject_info * inject = V3_Malloc(sizeof(struct v3_env_inject_info)); + if (!inject) { + PrintError(VM_NONE, VCORE_NONE, "Cannot allocate in inserting environment inject\n"); + return -1; + } + + memset(inject, 0, sizeof(struct v3_env_inject_info)); inject->env_vars = strings; @@ -92,7 +98,7 @@ int v3_insert_env_inject (void * ginfo, char ** strings, int num_strings, char * int v3_remove_env_inject (struct v3_vm_info * vm, struct v3_env_inject_info * inject) { if (v3_unhook_executable(vm, inject->bin_name) < 0) { - PrintError("Problem unhooking executable in v3_remove_env_inject\n"); + PrintError(vm, VCORE_NONE, "Problem unhooking executable in v3_remove_env_inject\n"); return -1; } @@ -103,8 +109,8 @@ int v3_remove_env_inject (struct v3_vm_info * vm, struct v3_env_inject_info * in static struct v3_extension_impl env_inject_impl = { .name = "env_inject", - .init = init_env_inject, - .deinit = deinit_env_inject, + .vm_init = init_env_inject, + .vm_deinit = deinit_env_inject, .core_init = NULL, .core_deinit = NULL, .on_entry = NULL,