aboutsummaryrefslogtreecommitdiff
path: root/lib/libgeom/geom_xml2tree.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2015-03-26 12:17:47 +0000
committerAlexander Motin <mav@FreeBSD.org>2015-03-26 12:17:47 +0000
commit5523c82c1a804f3ce9dfff97afe0b61b24527861 (patch)
treeaae3d593194c3b8ad7d235fe3aad64e609c07a39 /lib/libgeom/geom_xml2tree.c
parent2f36085dcfeac50df82ebc147a95735f5a2a2717 (diff)
downloadsrc-5523c82c1a804f3ce9dfff97afe0b61b24527861.tar.gz
src-5523c82c1a804f3ce9dfff97afe0b61b24527861.zip
Make GEOM_PART work in presence of previous withered self.
MFC after: 2 weeks Sponsored by: iXsystems, Inc.
Notes
Notes: svn path=/head/; revision=280687
Diffstat (limited to 'lib/libgeom/geom_xml2tree.c')
-rw-r--r--lib/libgeom/geom_xml2tree.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c
index 2874cd0abd9c..d5d4f31fd858 100644
--- a/lib/libgeom/geom_xml2tree.c
+++ b/lib/libgeom/geom_xml2tree.c
@@ -186,6 +186,7 @@ static void
EndElement(void *userData, const char *name)
{
struct mystate *mt;
+ struct gconf *c;
struct gconfig *gc;
char *p;
@@ -259,7 +260,14 @@ EndElement(void *userData, const char *name)
return;
}
- if (mt->config != NULL) {
+ if (mt->config != NULL || (!strcmp(name, "wither") &&
+ (mt->provider != NULL || mt->geom != NULL))) {
+ if (mt->config != NULL)
+ c = mt->config;
+ else if (mt->provider != NULL)
+ c = &mt->provider->lg_config;
+ else
+ c = &mt->geom->lg_config;
gc = calloc(1, sizeof *gc);
if (gc == NULL) {
mt->error = errno;
@@ -270,14 +278,15 @@ EndElement(void *userData, const char *name)
}
gc->lg_name = strdup(name);
if (gc->lg_name == NULL) {
+ free(gc);
mt->error = errno;
XML_StopParser(mt->parser, 0);
warn("Cannot allocate memory during processing of '%s' "
"element", name);
return;
}
- gc->lg_val = p;
- LIST_INSERT_HEAD(mt->config, gc, lg_config);
+ gc->lg_val = p ? p : strdup("1");
+ LIST_INSERT_HEAD(c, gc, lg_config);
return;
}