errno: use staic errno to replace tl_errno before tls initialization
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
34397094d7
commit
d8ea482b58
@ -42,7 +42,7 @@
|
||||
#define set_errno(e) \
|
||||
do \
|
||||
{ \
|
||||
errno = (int)(e); \
|
||||
errno = (int)(e); \
|
||||
} \
|
||||
while (0)
|
||||
#define get_errno() errno
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user