Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions core/iwasm/common/wasm_runtime_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3909,13 +3909,8 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
goto fail;
}

#ifdef BH_PLATFORM_WINDOWS
address = strtok_s(cp, "/", &nextptr);
mask = strtok_s(NULL, "/", &nextptr);
#else
address = strtok_r(cp, "/", &nextptr);
mask = strtok_r(NULL, "/", &nextptr);
#endif
address = bh_strtok_r(cp, "/", &nextptr);
mask = bh_strtok_r(NULL, "/", &nextptr);

if (!mask) {
snprintf(error_buf, error_buf_size,
Expand Down
10 changes: 10 additions & 0 deletions core/shared/utils/bh_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ wa_strdup(const char *s)
return s1;
}

char *
bh_strtok_r(char *str, const char *delim, char **saveptr)
{
#if !(defined(_WIN32) || defined(_WIN32_))
return strtok_r(str, delim, saveptr);
#else
return strtok_s(str, delim, saveptr);
#endif
}

#if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
int
bh_system(const char *cmd)
Expand Down
3 changes: 3 additions & 0 deletions core/shared/utils/bh_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ bh_strdup(const char *s);
char *
wa_strdup(const char *s);

char *
bh_strtok_r(char *str, const char *delim, char **saveptr);

#if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
/* Executes a system command in bash/cmd.exe */
int
Expand Down
Loading