public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - config: fix loading of multiple objects with no subojects
@ 2008-11-11  5:41 Fabio M. Di Nitto
  0 siblings, 0 replies; only message in thread
From: Fabio M. Di Nitto @ 2008-11-11  5:41 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=bd261c8e51f3b5406f22bbb00b76f6da8722412d
Commit:        bd261c8e51f3b5406f22bbb00b76f6da8722412d
Parent:        864db5be81b13e9c3b62799de31b27c4e73d58c1
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Tue Nov 11 06:35:45 2008 +0100
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Tue Nov 11 06:35:45 2008 +0100

config: fix loading of multiple objects with no subojects

libxml returns a different value for <foo/> depending if foo has
child entries or not.

Use a bit of string magic to use the return value always in the same
way.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 config/plugins/xml/Makefile |    2 +-
 config/plugins/xml/config.c |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/config/plugins/xml/Makefile b/config/plugins/xml/Makefile
index 7e0f147..b95d005 100644
--- a/config/plugins/xml/Makefile
+++ b/config/plugins/xml/Makefile
@@ -10,7 +10,7 @@ include $(OBJDIR)/make/clean.mk
 include $(OBJDIR)/make/install.mk
 include $(OBJDIR)/make/uninstall.mk
 
-CFLAGS += -fPIC
+CFLAGS += -fPIC -D_GNU_SOURCE
 CFLAGS += `xml2-config --cflags`
 CFLAGS += -I${cmanincdir}/../daemon
 CFLAGS += -I${incdir}
diff --git a/config/plugins/xml/config.c b/config/plugins/xml/config.c
index 9813451..50a9172 100644
--- a/config/plugins/xml/config.c
+++ b/config/plugins/xml/config.c
@@ -211,14 +211,14 @@ static int read_config_for(xmlXPathContextPtr ctx, struct objdb_iface_ver0 *objd
 		ret++;
 
 		if(!prevstr) {
-			prevstr = strdup(str);
+			prevstr = strndup(str, (strstr(str, "=") - str));
 		} else {
-			if(!strcmp(str, prevstr)) {
+			if(!strncmp(str, prevstr, (strstr(str, "=") - str))) {
 				nodecount++;
 			} else {
 				nodecount = 1;
 				free(prevstr);
-				prevstr = strdup(str);
+				prevstr = strndup(str, (strstr(str, "=") - str));
 			}
 		}
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-11  5:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-11  5:41 master - config: fix loading of multiple objects with no subojects Fabio M. Di Nitto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).