errno: use staic errno to replace tl_errno before tls initialization

Change-Id: I44a53b2f5cdb3f4e6c755e5663867cd74361bc7c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong
2021-09-09 21:03:42 +08:00
parent 00d49aa9c2
commit aa1c65a364
2 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -42,7 +42,7 @@
#define set_errno(e) \
do \
{ \
errno = (int)(e); \
errno = (int)(e); \
} \
while (0)
#define get_errno() errno
+7 -1
View File
@@ -29,6 +29,12 @@
#include <arch/tls.h>
/****************************************************************************
* Private Data
****************************************************************************/
static int g_errno;
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -57,5 +63,5 @@ FAR int *__errno(void)
/* And return the return refernce to the error number */
return &tlsinfo->tl_errno;
return tlsinfo ? &tlsinfo->tl_errno : &g_errno;
}