@@ -97,6 +97,7 @@ validateTzEntry(tzEntry *tzentry)
97
97
static bool
98
98
splitTzLine (const char * filename , int lineno , char * line , tzEntry * tzentry )
99
99
{
100
+ char * brkl ;
100
101
char * abbrev ;
101
102
char * offset ;
102
103
char * offset_endptr ;
@@ -106,7 +107,7 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
106
107
tzentry -> lineno = lineno ;
107
108
tzentry -> filename = filename ;
108
109
109
- abbrev = strtok (line , WHITESPACE );
110
+ abbrev = strtok_r (line , WHITESPACE , & brkl );
110
111
if (!abbrev )
111
112
{
112
113
GUC_check_errmsg ("missing time zone abbreviation in time zone file \"%s\", line %d" ,
@@ -115,7 +116,7 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
115
116
}
116
117
tzentry -> abbrev = pstrdup (abbrev );
117
118
118
- offset = strtok (NULL , WHITESPACE );
119
+ offset = strtok_r (NULL , WHITESPACE , & brkl );
119
120
if (!offset )
120
121
{
121
122
GUC_check_errmsg ("missing time zone offset in time zone file \"%s\", line %d" ,
@@ -135,11 +136,11 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
135
136
return false;
136
137
}
137
138
138
- is_dst = strtok (NULL , WHITESPACE );
139
+ is_dst = strtok_r (NULL , WHITESPACE , & brkl );
139
140
if (is_dst && pg_strcasecmp (is_dst , "D" ) == 0 )
140
141
{
141
142
tzentry -> is_dst = true;
142
- remain = strtok (NULL , WHITESPACE );
143
+ remain = strtok_r (NULL , WHITESPACE , & brkl );
143
144
}
144
145
else
145
146
{
@@ -158,7 +159,7 @@ splitTzLine(const char *filename, int lineno, char *line, tzEntry *tzentry)
158
159
tzentry -> zone = pstrdup (offset );
159
160
tzentry -> offset = 0 * SECS_PER_HOUR ;
160
161
tzentry -> is_dst = false;
161
- remain = strtok (NULL , WHITESPACE );
162
+ remain = strtok_r (NULL , WHITESPACE , & brkl );
162
163
}
163
164
164
165
if (!remain ) /* no more non-whitespace chars */
@@ -394,8 +395,9 @@ ParseTzFile(const char *filename, int depth,
394
395
{
395
396
/* pstrdup so we can use filename in result data structure */
396
397
char * includeFile = pstrdup (line + strlen ("@INCLUDE" ));
398
+ char * brki ;
397
399
398
- includeFile = strtok (includeFile , WHITESPACE );
400
+ includeFile = strtok_r (includeFile , WHITESPACE , & brki );
399
401
if (!includeFile || !* includeFile )
400
402
{
401
403
GUC_check_errmsg ("@INCLUDE without file name in time zone file \"%s\", line %d" ,
0 commit comments