Skip to content

Commit

Permalink
asyn-thread: fix Curl_thread_create result check
Browse files Browse the repository at this point in the history
- 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 #13542
  • Loading branch information
jay committed May 7, 2024
1 parent 22cde3b commit 62ae1f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/asyn-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 62ae1f1

Please sign in to comment.