3082. [port] strtok_r is threads only. [RT #23747]

This commit is contained in:
Mark Andrews
2011-03-21 00:30:18 +00:00
parent c783bc8968
commit 653cad790b
2 changed files with 15 additions and 7 deletions

View File

@@ -1,3 +1,5 @@
3082. [port] strtok_r is threads only. [RT #23747]
3081. [bug] Failure of DNAME substitution did not return 3081. [bug] Failure of DNAME substitution did not return
YXDOMAIN. [RT #23591] YXDOMAIN. [RT #23591]

View File

@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: driver.c,v 1.4 2011/03/17 09:25:54 fdupont Exp $ */ /* $Id: driver.c,v 1.5 2011/03/21 00:30:18 marka Exp $ */
/* /*
* This provides a very simple example of an external loadable DLZ * This provides a very simple example of an external loadable DLZ
@@ -39,7 +39,11 @@
#include "driver.h" #include "driver.h"
#ifdef WIN32 #ifdef WIN32
#define strtok_r(a, b, c) strtok_s(a, b, c) #define STRTOK_R(a, b, c) strtok_s(a, b, c)
#elif defined(_REENTRANT)
#define STRTOK_R(a, b, c) strtok_r(a, b, c)
#else
#define STRTOK_R(a, b, c) strtok(a, b)
#endif #endif
/* For this simple example, use fixed sized strings */ /* For this simple example, use fixed sized strings */
@@ -474,7 +478,9 @@ modrdataset(struct dlz_example_data *state, const char *name,
char *full_name, *dclass, *type, *data, *ttlstr; char *full_name, *dclass, *type, *data, *ttlstr;
char *buf = strdup(rdatastr); char *buf = strdup(rdatastr);
isc_result_t result; isc_result_t result;
#if defined(WIN32) || defined(_REENTRANT)
char *saveptr = NULL; char *saveptr = NULL;
#endif
/* /*
* The format is: * The format is:
@@ -484,23 +490,23 @@ modrdataset(struct dlz_example_data *state, const char *name,
* for the type used by dig * for the type used by dig
*/ */
full_name = strtok_r(buf, "\t", &saveptr); full_name = STRTOK_R(buf, "\t", &saveptr);
if (full_name == NULL) if (full_name == NULL)
return (ISC_R_FAILURE); return (ISC_R_FAILURE);
ttlstr = strtok_r(NULL, "\t", &saveptr); ttlstr = STRTOK_R(NULL, "\t", &saveptr);
if (ttlstr == NULL) if (ttlstr == NULL)
return (ISC_R_FAILURE); return (ISC_R_FAILURE);
dclass = strtok_r(NULL, "\t", &saveptr); dclass = STRTOK_R(NULL, "\t", &saveptr);
if (dclass == NULL) if (dclass == NULL)
return (ISC_R_FAILURE); return (ISC_R_FAILURE);
type = strtok_r(NULL, "\t", &saveptr); type = STRTOK_R(NULL, "\t", &saveptr);
if (type == NULL) if (type == NULL)
return (ISC_R_FAILURE); return (ISC_R_FAILURE);
data = strtok_r(NULL, "\t", &saveptr); data = STRTOK_R(NULL, "\t", &saveptr);
if (data == NULL) if (data == NULL)
return (ISC_R_FAILURE); return (ISC_R_FAILURE);