-Coders,
now that strtok should have been replaced by strtok_r in all 5.[123].x code, I
noticed that there are still some occurrences of strtok() in perl/SNMP/SNMP.xs.
I've updated patch tracker item #1040330 accordingly. Since SF doesn't allow me
to attach the patch there, please find it attached to this mail.
+Thomas
--
Thomas Anders (thomas.anders at blue-cable.de)
Index: perl/SNMP/SNMP.xs
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/perl/SNMP/SNMP.xs,v
retrieving revision 5.46
diff -u -r5.46 SNMP.xs
--- perl/SNMP/SNMP.xs 9 Oct 2004 04:38:20 -0000 5.46
+++ perl/SNMP/SNMP.xs 23 May 2005 12:30:40 -0000
@@ -819,9 +819,10 @@
char *first = NULL, *result = NULL, *entry;
const char *position;
char *newkey = strdup(key);
+ char *st;
- entry = strtok(newkey, "*");
+ entry = strtok_r(newkey, "*", &st);
position = search_base;
while (entry) {
result = strcasestr(position, entry);
@@ -835,7 +836,7 @@
first = result;
position = result + strlen(entry);
- entry = strtok(NULL, "*");
+ entry = strtok_r(NULL, "*", &st);
}
free(newkey);
if (result)
@@ -1008,15 +1009,16 @@
{
char soid_buf[STR_BUF_SIZE];
char *cp;
+ char *st;
if (!soid_str || !*soid_str) return SUCCESS;/* successfully added nothing */
if (*soid_str == '.') soid_str++;
strcpy(soid_buf, soid_str);
- cp = strtok(soid_buf,".");
+ cp = strtok_r(soid_buf,".",&st);
while (cp) {
sscanf(cp, "%lu", &(doid_arr[(*doid_arr_len)++]));
/* doid_arr[(*doid_arr_len)++] = atoi(cp); */
- cp = strtok(NULL,".");
+ cp = strtok_r(NULL,".",&st);
}
return(SUCCESS);
}