mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-10-21 15:32:02 +08:00
feat(newlib): Initialize environ
This commit is contained in:
@@ -14,7 +14,9 @@
|
|||||||
|
|
||||||
#include <reent.h>
|
#include <reent.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Initialize global and thread's private reent object data. We add this instead of
|
* @brief Initialize global and thread's private reent object data. We add this instead of
|
||||||
@@ -57,8 +59,15 @@ int esp_newlib_init(void)
|
|||||||
if (!_GLOBAL_REENT->_stdin)
|
if (!_GLOBAL_REENT->_stdin)
|
||||||
goto err_in;
|
goto err_in;
|
||||||
|
|
||||||
|
environ = malloc(sizeof(char*));
|
||||||
|
if (!environ)
|
||||||
|
goto environ_in;
|
||||||
|
environ[0] = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
environ_in:
|
||||||
|
fclose(_GLOBAL_REENT->_stdin);
|
||||||
err_in:
|
err_in:
|
||||||
fclose(_GLOBAL_REENT->_stderr);
|
fclose(_GLOBAL_REENT->_stderr);
|
||||||
err_fail:
|
err_fail:
|
||||||
|
Reference in New Issue
Block a user