[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/ccs/daemon cnx_mgr.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh sourceware org	2007-03-19 20:03:16

Modified files:
	ccs/daemon     : cnx_mgr.c 

Log message:
	Fix #232139

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/daemon/cnx_mgr.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.24.2.14&r2=1.24.2.15

--- cluster/ccs/daemon/cnx_mgr.c	2007/02/13 20:54:56	1.24.2.14
+++ cluster/ccs/daemon/cnx_mgr.c	2007/03/19 20:03:15	1.24.2.15
@@ -870,32 +870,40 @@
 	      (node->type == 1)? "XML_ELEMENT_NODE":
 	      (node->type == 2)? "XML_ATTRIBUTE_NODE":"");
 
-      if(!node || !node->children ||
-         !node->children->content || !strlen(node->children->content)){
+      if(!node) {
 	log_dbg("No content found.\n");
 	error = -ENODATA;
 	goto fail;
       }
 
-      log_dbg("Query results:: %s\n", node->children->content);
-
       if(((node->type == XML_ATTRIBUTE_NODE) && strstr(query, "@*")) ||
 	 ((node->type == XML_ELEMENT_NODE) && strstr(query, "child::*"))){
 	/* add on the trailing NULL and the '=' separator for a list of attrs
 	   or an element node + CDATA*/
-	size = strlen(node->children->content)+strlen(node->name)+2;
+	if (node->children && node->children->content)
+	  size = strlen(node->children->content)+strlen(node->name)+2;
+	else 
+	  size = strlen(node->name)+2;
 	nnv= 1;
       } else {
-	size = strlen(node->children->content)+1;
+	if (node->children && node->children->content) {
+	  size = strlen(node->children->content)+1;
+	} else {
+          error = -ENODATA;
+	  goto fail;
+        }
       }
 
       if(size <= ch->comm_payload_size){  /* do we already have enough space? */
 	log_dbg("No extra space needed.\n");
 	if(nnv){
-	  sprintf(*payload, "%s=%s", node->name,node->children->content);
-	}else {
-	  sprintf(*payload, "%s", node->children->content);
+	  sprintf(*payload, "%s=%s", node->name, node->children ?
+					 (char *)node->children->content:"");
+	} else {
+	  sprintf(*payload, "%s", node->children ? node->children->content :
+				  node->name);
 	}
+
       } else {
 	log_dbg("Extra space needed.\n");
 	free(*payload);
@@ -905,11 +913,14 @@
 	  goto fail;
 	}
 	if(nnv){
-	  sprintf(*payload, "%s=%s", node->name, node->children->content);
-	}else {
-	  sprintf(*payload, "%s", node->children->content);
+	  sprintf(*payload, "%s=%s", node->name, node->children ?
+					 (char *)node->children->content:"");
+	} else {
+	  sprintf(*payload, "%s", node->children ? node->children->content :
+				  node->name);
 	}
       }
+      log_dbg("Query results:: %s\n", *payload);
       ch->comm_payload_size = size;
     } else {
       log_dbg("No nodes found.\n");
@@ -1079,7 +1090,7 @@
     goto fail;
   }
 
-  if(ch->comm_desc < 0 || ch->comm_desc >= MAX_OPEN_CONNECTIONS){
+  if(ch->comm_desc < 0){
     log_err("Invalid descriptor specified (%d).\n", ch->comm_desc);
     log_err("Someone may be attempting something evil.\n");
     error = -EBADR;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]