X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Frrd_graph_helper.c;h=44f2c173f359782be8bdc74e28a9b23a6ead02f8;hb=3a9760d1aea27a60cf558cf8998042acc455fd61;hp=cac3d7a6e56dda44977f280a8c0abc74b5559642;hpb=aed5641cac5013af2b076e0aba9c998a4de3c2dd;p=rrdtool.git diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index cac3d7a..44f2c17 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -791,13 +791,14 @@ int rrd_parse_PVHLAST( char csv[64]; char *pch; float dsh; - - strcpy(csv, tmpstr); int count = 0; + char *saveptr; - pch = strtok(tmpstr, ","); + strcpy(csv, tmpstr); + + pch = strtok_r(tmpstr, ",",&saveptr); while (pch != NULL) { - pch = strtok(NULL, ","); + pch = strtok_r(NULL, ",",&saveptr); count++; } dprintf("- %d dash value(s) found: ", count); @@ -805,7 +806,7 @@ int rrd_parse_PVHLAST( gdp->dash = 1; gdp->ndash = count; gdp->p_dashes = (double *) malloc(sizeof(double) * count); - pch = strtok(csv, ","); + pch = strtok_r(csv, ",",&saveptr); count = 0; while (pch != NULL) { if (sscanf(pch, "%f", &dsh)) { @@ -813,7 +814,7 @@ int rrd_parse_PVHLAST( dprintf("%.1f ", gdp->p_dashes[count]); count++; } - pch = strtok(NULL, ","); + pch = strtok_r(NULL, ",",&saveptr); } dprintf("\n"); } else