From: Brendan Hansen Date: Thu, 2 Dec 2021 04:12:48 +0000 (-0600) Subject: bugfix with linux spawn process X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=d0a810d741d9bc394a009524a65e00a975aa5c3d;p=onyx.git bugfix with linux spawn process --- diff --git a/src/wasm_runtime.c b/src/wasm_runtime.c index f01c93f0..b3d8d4c2 100644 --- a/src/wasm_runtime.c +++ b/src/wasm_runtime.c @@ -191,16 +191,16 @@ static wasm_trap_t* onyx_spawn_process_impl(const wasm_val_vec_t* params, wasm_v byte_t* array_loc = data + args_ptr; fori (i, 0, args_len) { char *arg_str = data + *(i32 *) (array_loc + i * 2 * POINTER_SIZE); - i32 arg_len = *(i32 *) (array_loc + i * 2 * POINTER_SIZE + 4); + i32 arg_len = *(i32 *) (array_loc + i * 2 * POINTER_SIZE + POINTER_SIZE); char *arg = bh_alloc_array(global_scratch_allocator, char, arg_len + 1); memcpy(arg, arg_str, arg_len); arg[arg_len] = '\0'; - process_args[i - 1] = arg; + process_args[i + 1] = arg; } process_args[0] = process_path; process_args[args_len + 1] = NULL; - + if (fork() == 0) { execv(process_path, process_args); }