aboutsummaryrefslogtreecommitdiff
path: root/lib/vtls
diff options
context:
space:
mode:
authorToby Peterson <toby@apple.com>2014-08-05 08:58:49 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-08-05 08:58:49 +0200
commit0e452a02f1583b0d3ef86aaeb73fc665f3a8f6c0 (patch)
tree93a405434f5847fc925c564a289f2e6e9e3740d9 /lib/vtls
parentea6d371e7cd07e24d9eb453ca0d903dfb8599c43 (diff)
darwinssl: don't use strtok()
The GetDarwinVersionNumber() function uses strtok, which is not thread-safe.
Diffstat (limited to 'lib/vtls')
-rw-r--r--lib/vtls/curl_darwinssl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/vtls/curl_darwinssl.c b/lib/vtls/curl_darwinssl.c
index 480e06e6b..bfa5c6acd 100644
--- a/lib/vtls/curl_darwinssl.c
+++ b/lib/vtls/curl_darwinssl.c
@@ -30,6 +30,7 @@
#include "urldata.h" /* for the SessionHandle definition */
#include "curl_base64.h"
+#include "strtok.h"
#ifdef USE_DARWINSSL
@@ -782,6 +783,7 @@ CF_INLINE void GetDarwinVersionNumber(int *major, int *minor)
char *os_version;
size_t os_version_len;
char *os_version_major, *os_version_minor/*, *os_version_point*/;
+ char *tok_buf;
/* Get the Darwin kernel version from the kernel using sysctl(): */
mib[0] = CTL_KERN;
@@ -797,9 +799,9 @@ CF_INLINE void GetDarwinVersionNumber(int *major, int *minor)
}
/* Parse the version: */
- os_version_major = strtok(os_version, ".");
- os_version_minor = strtok(NULL, ".");
- /*os_version_point = strtok(NULL, ".");*/
+ os_version_major = strtok_r(os_version, ".", &tok_buf);
+ os_version_minor = strtok_r(NULL, ".", &tok_buf);
+ /*os_version_point = strtok_r(NULL, ".", &tok_buf);*/
*major = atoi(os_version_major);
*minor = atoi(os_version_minor);
free(os_version);