From a6fd32788445c9864fbda1e975c998c70f398bcb Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 15 Jul 2024 21:31:22 -0400 Subject: [PATCH] pthread: Account for more errors than B_BAD_THREAD_ID in pthread_getname_np. --- src/system/libroot/posix/pthread/pthread.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system/libroot/posix/pthread/pthread.cpp b/src/system/libroot/posix/pthread/pthread.cpp index 8ca7831d33..b28b0646d3 100644 --- a/src/system/libroot/posix/pthread/pthread.cpp +++ b/src/system/libroot/posix/pthread/pthread.cpp @@ -325,6 +325,8 @@ pthread_getname_np(pthread_t thread, char* buffer, size_t length) status_t status = _kern_get_thread_info(thread->id, &info); if (status == B_BAD_THREAD_ID) return ESRCH; + if (status < B_OK) + return status; if (strlcpy(buffer, info.name, length) >= length) return ERANGE; return 0;