Initialize `environ` even if there are no environment variables, so that
it alwasy points to a NULL-terminated array even if that array just
contains the NULL. This fixes src/functional/env.c.
if (err != __WASI_ESUCCESS) {
return err;
}
if (err != __WASI_ESUCCESS) {
return err;
}
- /* If there's no environment pairs, make sure environ is null and return. */
- if (environ_count == 0) {
- __environ = NULL;
- return __WASI_ESUCCESS;
- }
/* Allocate memory for the array of pointers, plus one terminating null pointer. */
__environ = malloc(sizeof(char *) * (environ_count + 1));
/* Allocate memory for the array of pointers, plus one terminating null pointer. */
__environ = malloc(sizeof(char *) * (environ_count + 1));