__error could be called too early before libthr is initialized, test
this case and return global varible errno instead.
This commit is contained in:
parent
b31da03fd8
commit
9bbc6c7f54
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=160284
@ -45,10 +45,12 @@ extern int errno;
|
|||||||
int *
|
int *
|
||||||
__error(void)
|
__error(void)
|
||||||
{
|
{
|
||||||
struct pthread *curthread = _get_curthread();
|
struct pthread *curthread;
|
||||||
|
|
||||||
|
if (_thr_initial != NULL) {
|
||||||
|
curthread = _get_curthread();
|
||||||
if (curthread != NULL && curthread != _thr_initial)
|
if (curthread != NULL && curthread != _thr_initial)
|
||||||
return (&curthread->error);
|
return (&curthread->error);
|
||||||
else
|
}
|
||||||
return (&errno);
|
return (&errno);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user