summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d7fe79f)
raw | patch | inline | side by side (parent: d7fe79f)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 20 Dec 2009 12:15:06 +0000 (12:15 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 20 Dec 2009 12:15:06 +0000 (12:15 +0000) |
blank last_ds entries ... as reported in #247.
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1992 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1992 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_restore.c | patch | blob | history |
diff --git a/src/rrd_restore.c b/src/rrd_restore.c
index 91545ca2f2e518bfd5f98301239f23221cdf56cf..2f671a1103fc98d995fc2fc1bf1d812b80655464 100644 (file)
--- a/src/rrd_restore.c
+++ b/src/rrd_restore.c
char *exp_name)
{
xmlChar *name;
- name = get_xml_element(reader);
+ /* maybe we are already on the end element ... lets see */
+ if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT){
+ xmlChar *temp;
+ xmlChar *temp2;
+ temp = xmlTextReaderName(reader);
+ temp2 = (xmlChar*)sprintf_alloc("/%s", temp);
+ name = xmlStrdup(temp2);
+ xmlFree(temp);
+ free(temp2);
+ } else {
+ name = get_xml_element(reader);
+ }
+
if (name == NULL)
return -1;
if (xmlStrcasecmp(name+1,(xmlChar *)exp_name) != 0 || name[0] != '/'){
if (type == XML_READER_TYPE_ELEMENT){
xmlChar *name;
name = xmlTextReaderName(reader);
- rrd_set_error("line %d: expected a value but found an <%s> element",
+ rrd_set_error("line %d: expected a value but found a <%s> element",
xmlTextReaderGetParserLineNumber(reader),
name);
xmlFree(name);
return NULL;
}
+
+ /* trying to read text from <a></a> we end up here
+ lets return an empty string insead. This is a tad optimistic
+ since we do not check if it is actually </a> and not </b>
+ we got, but first we do not know if we expect </a> and second
+ we the whole implementation is on the optimistic side. */
+ if (type == XML_READER_TYPE_END_ELEMENT){
+ return xmlStrdup(BAD_CAST "");
+ }
+
/* skip all other non-text */
- if (xmlTextReaderNodeType(reader) != XML_READER_TYPE_TEXT)
+ if (type != XML_READER_TYPE_TEXT)
continue;
text = xmlTextReaderValue(reader);