]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
asyn-thread: fix Curl_thread_create result check
authorJay Satiro <raysatiro@yahoo.com>
Mon, 6 May 2024 18:49:43 +0000 (14:49 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Tue, 7 May 2024 06:28:58 +0000 (02:28 -0400)
- Compare to curl_thread_t_null instead of 0 for error.

Currently for both supported thread libraries (pthreads and Windows)
curl_thread_t_null is defined as 0. However, the pattern throughout the
code is to check against curl_thread_t_null and not 0 since for
posterity some thread library may not use 0 for error.

Closes https://github.com/curl/curl/pull/13542

lib/asyn-thread.c

index 87d34a7e4303d16fba5d9f10b084f37790e3f3e7..f537c0b9f305c76e7df8d8e1ee847d3a4623a960 100644 (file)
@@ -672,7 +672,7 @@ static bool init_resolve_thread(struct Curl_easy *data,
   td->thread_hnd = Curl_thread_create(gethostbyname_thread, &td->tsd);
 #endif
 
-  if(!td->thread_hnd) {
+  if(td->thread_hnd == curl_thread_t_null) {
     /* The thread never started, so mark it as done here for proper cleanup. */
     td->tsd.done = 1;
     err = errno;