htl: Check error returned by __getrlimit

This commit is contained in:
Samuel Thibault 2023-01-02 01:01:28 +01:00
parent a09183aed7
commit 3a614f39e6

View File

@ -136,8 +136,8 @@ __pthread_create_internal (struct __pthread **thread,
if (stacksize == 0) if (stacksize == 0)
{ {
struct rlimit rlim; struct rlimit rlim;
__getrlimit (RLIMIT_STACK, &rlim); err = __getrlimit (RLIMIT_STACK, &rlim);
if (rlim.rlim_cur != RLIM_INFINITY) if (err == 0 && rlim.rlim_cur != RLIM_INFINITY)
stacksize = rlim.rlim_cur; stacksize = rlim.rlim_cur;
if (stacksize == 0) if (stacksize == 0)
stacksize = PTHREAD_STACK_DEFAULT; stacksize = PTHREAD_STACK_DEFAULT;