BUG/MINOR: thread: add a check for pthread_create

preload_libgcc_s() use pthread_create to create a thread and then call
pthread_join to use it, but it doesn't check if the option is successful.
So add a check to aviod potential crash.
This commit is contained in:
eaglegai 2023-05-26 16:44:34 +08:00 committed by Willy Tarreau
parent 15c3d20e31
commit ef667b1ad8

View File

@ -1066,8 +1066,8 @@ static void *dummy_thread_function(void *data)
static inline void preload_libgcc_s(void)
{
pthread_t dummy_thread;
pthread_create(&dummy_thread, NULL, dummy_thread_function, NULL);
pthread_join(dummy_thread, NULL);
if (pthread_create(&dummy_thread, NULL, dummy_thread_function, NULL) == 0)
pthread_join(dummy_thread, NULL);
}
static void __thread_init(void)