__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 (curthread != NULL && curthread != _thr_initial)
|
if (_thr_initial != NULL) {
|
||||||
return (&curthread->error);
|
curthread = _get_curthread();
|
||||||
else
|
if (curthread != NULL && curthread != _thr_initial)
|
||||||
return (&errno);
|
return (&curthread->error);
|
||||||
|
}
|
||||||
|
return (&errno);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user