X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_restore.c;h=9af8ab00604e0941df9ac9d054ea1095279e7889;hb=9bd649847b9875c6babd44aa929a7bac2b6a5091;hp=f803ab68bfe99be49346a3fe6b9ee0cc1ae6624b;hpb=aff0a2728543eee1ac21f3fa02f171caae8d9362;p=rrdtool.git diff --git a/src/rrd_restore.c b/src/rrd_restore.c index f803ab6..9af8ab0 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -36,9 +36,6 @@ #ifndef WIN32 # include /* for off_t */ #else -# define random() rand() -# define srandom(x) srand(x) -# define getpid() 0 typedef size_t ssize_t; typedef long off_t; #endif @@ -143,6 +140,13 @@ static int get_double_from_node( return (-1); } + if (strstr(str_ptr, "NaN") != NULL) + { + *value = DNAN; + xmlFree(str_ptr); + return 0; + } + end_ptr = NULL; temp = strtod(str_ptr, &end_ptr); xmlFree(str_ptr); @@ -706,7 +710,7 @@ static int parse_tag_rra( } /* Set the RRA pointer to a random location */ - cur_rra_ptr->cur_row = random() % cur_rra_def->row_cnt; + cur_rra_ptr->cur_row = rrd_random() % cur_rra_def->row_cnt; return (status); } /* int parse_tag_rra */ @@ -1054,7 +1058,6 @@ int rrd_restore( { rrd_t *rrd; - srandom((unsigned int) time(NULL) + (unsigned int) getpid()); /* init rrd clean */ optind = 0; opterr = 0; /* initialize getopt */