diff --git a/core/iwasm/aot/aot_loader.c b/core/iwasm/aot/aot_loader.c index 97360e73e7..cb6526d9f9 100644 --- a/core/iwasm/aot/aot_loader.c +++ b/core/iwasm/aot/aot_loader.c @@ -4120,6 +4120,12 @@ create_module(char *name, char *error_buf, uint32 error_buf_size) } #endif +#if WASM_ENABLE_LIBC_WASI != 0 + module->wasi_args.stdio[0] = os_get_raw_invalid_handle(); + module->wasi_args.stdio[1] = os_get_raw_invalid_handle(); + module->wasi_args.stdio[2] = os_get_raw_invalid_handle(); +#endif + return module; #if WASM_ENABLE_GC != 0 fail2: diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c index e72bf94fab..494ee3b5dc 100644 --- a/core/iwasm/interpreter/wasm_loader.c +++ b/core/iwasm/interpreter/wasm_loader.c @@ -6368,6 +6368,12 @@ create_module(char *name, char *error_buf, uint32 error_buf_size) } #endif +#if WASM_ENABLE_LIBC_WASI != 0 + module->wasi_args.stdio[0] = os_get_raw_invalid_handle(); + module->wasi_args.stdio[1] = os_get_raw_invalid_handle(); + module->wasi_args.stdio[2] = os_get_raw_invalid_handle(); +#endif + (void)ret; return module; diff --git a/core/shared/platform/linux/platform_internal.h b/core/shared/platform/linux/platform_internal.h index 865180273e..1684605580 100644 --- a/core/shared/platform/linux/platform_internal.h +++ b/core/shared/platform/linux/platform_internal.h @@ -132,6 +132,12 @@ os_get_invalid_handle(void) return -1; } +static inline os_raw_file_handle +os_get_raw_invalid_handle(void) +{ + return -1; +} + #ifdef __cplusplus } #endif