X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_restore.c;h=96ab64961a6aaad924572b62025a16c6408bbe2f;hb=2e6c98e893777e4abf7b05cb4ecf81dde088cdb8;hp=29a97b3bf67260a946bd9ac9e950b11ebf9cd458;hpb=5b9934cea6164cb4c1bb15a4400af2f861a4a834;p=rrdtool.git diff --git a/src/rrd_restore.c b/src/rrd_restore.c index 29a97b3..96ab649 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.2.13 Copyright by Tobi Oetiker, 1997-2006 + * RRDtool 1.2.19 Copyright by Tobi Oetiker, 1997-2007 ***************************************************************************** * rrd_restore.c creates new rrd from data dumped by rrd_dump.c *****************************************************************************/ @@ -18,6 +18,7 @@ void xml_lc(char*); int skip(char **); +int skipxml(char **); int eat_tag(char **, char *); int read_tag(char **, char *, char *, void *); int xml2rrd(char*, rrd_t*, char); @@ -44,6 +45,24 @@ void xml_lc(char* buf){ } } +int skipxml(char **buf){ + char *ptr; + ptr=(*buf); + do { + (*buf)=ptr; + while((*(ptr+1)) && ((*ptr)==' ' || (*ptr)=='\r' || (*ptr)=='\n' || (*ptr)=='\t')) ptr++; + if (strncmp(ptr,""); + if (ptr) ptr+=2; else { + rrd_set_error("Dangling XML header"); + (*buf) = NULL; + return -1; + } + } + } while ((*buf)!=ptr); + return 1; +} + int skip(char **buf){ char *ptr; ptr=(*buf); @@ -118,6 +137,8 @@ int xml2rrd(char* buf, rrd_t* rrd, char rc){ ptr2=buf; ptr3=buf; /* start with an RRD tag */ + + skipxml(&ptr); eat_tag(&ptr,"rrd"); /* allocate static header */