summaryrefslogtreecommitdiff
path: root/Utilities/cmcurl/lib/curl_threads.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-10-04 07:28:34 -0400
committerBrad King <brad.king@kitware.com>2017-10-10 11:15:16 -0400
commit9e3ef40edb6eae36e822c129bec5d4ee9de0dd57 (patch)
treec739e929f90b5e6c4e26d4f5fea7f17d3772aefb /Utilities/cmcurl/lib/curl_threads.c
parent2fad0e20b6b2b4c3cfc177267cf9689658f50c23 (diff)
parentde7c21d677db1ddaeece03c19e13e448f4031511 (diff)
downloadcmake-9e3ef40edb6eae36e822c129bec5d4ee9de0dd57.tar.gz
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2017-10-04 (3ea76790)
Diffstat (limited to 'Utilities/cmcurl/lib/curl_threads.c')
-rw-r--r--Utilities/cmcurl/lib/curl_threads.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/Utilities/cmcurl/lib/curl_threads.c b/Utilities/cmcurl/lib/curl_threads.c
index a78eff5c2f..c1624a9136 100644
--- a/Utilities/cmcurl/lib/curl_threads.c
+++ b/Utilities/cmcurl/lib/curl_threads.c
@@ -104,15 +104,22 @@ int Curl_thread_join(curl_thread_t *hnd)
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
void *arg)
{
+ curl_thread_t t;
#ifdef _WIN32_WCE
- return CreateThread(NULL, 0, func, arg, 0, NULL);
+ t = CreateThread(NULL, 0, func, arg, 0, NULL);
#else
- curl_thread_t t;
t = (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL);
- if((t == 0) || (t == (curl_thread_t)-1L))
+#endif
+ if((t == 0) || (t == LongToHandle(-1L))) {
+#ifdef _WIN32_WCE
+ DWORD gle = GetLastError();
+ errno = ((gle == ERROR_ACCESS_DENIED ||
+ gle == ERROR_NOT_ENOUGH_MEMORY) ?
+ EACCES : EINVAL);
+#endif
return curl_thread_t_null;
+ }
return t;
-#endif
}
void Curl_thread_destroy(curl_thread_t hnd)