Commit 60e15a24 authored by stewart@mysql.com's avatar stewart@mysql.com

Merge mysql.com:/home/stewart/Documents/MySQL/5.0/bug19932

into  mysql.com:/home/stewart/Documents/MySQL/5.0/merge-queue
parents 9b3fdd0b 7aa0eb4f
...@@ -678,7 +678,11 @@ ndb_mgm_get_status(NdbMgmHandle handle) ...@@ -678,7 +678,11 @@ ndb_mgm_get_status(NdbMgmHandle handle)
out.println(""); out.println("");
char buf[1024]; char buf[1024];
in.gets(buf, sizeof(buf)); if(!in.gets(buf, sizeof(buf)))
{
SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected");
return NULL;
}
if(buf[strlen(buf)-1] == '\n') if(buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = '\0'; buf[strlen(buf)-1] = '\0';
...@@ -687,7 +691,11 @@ ndb_mgm_get_status(NdbMgmHandle handle) ...@@ -687,7 +691,11 @@ ndb_mgm_get_status(NdbMgmHandle handle)
return NULL; return NULL;
} }
in.gets(buf, sizeof(buf)); if(!in.gets(buf, sizeof(buf)))
{
SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY, "Probably disconnected");
return NULL;
}
if(buf[strlen(buf)-1] == '\n') if(buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = '\0'; buf[strlen(buf)-1] = '\0';
...@@ -710,6 +718,13 @@ ndb_mgm_get_status(NdbMgmHandle handle) ...@@ -710,6 +718,13 @@ ndb_mgm_get_status(NdbMgmHandle handle)
malloc(sizeof(ndb_mgm_cluster_state)+ malloc(sizeof(ndb_mgm_cluster_state)+
noOfNodes*(sizeof(ndb_mgm_node_state)+sizeof("000.000.000.000#"))); noOfNodes*(sizeof(ndb_mgm_node_state)+sizeof("000.000.000.000#")));
if(!state)
{
SET_ERROR(handle, NDB_MGM_OUT_OF_MEMORY,
"Allocating ndb_mgm_cluster_state");
return NULL;
}
state->no_of_nodes= noOfNodes; state->no_of_nodes= noOfNodes;
ndb_mgm_node_state * ptr = &state->node_states[0]; ndb_mgm_node_state * ptr = &state->node_states[0];
int nodeId = 0; int nodeId = 0;
...@@ -719,7 +734,13 @@ ndb_mgm_get_status(NdbMgmHandle handle) ...@@ -719,7 +734,13 @@ ndb_mgm_get_status(NdbMgmHandle handle)
} }
i = -1; ptr--; i = -1; ptr--;
for(; i<noOfNodes; ){ for(; i<noOfNodes; ){
in.gets(buf, sizeof(buf)); if(!in.gets(buf, sizeof(buf)))
{
free(state);
SET_ERROR(handle, NDB_MGM_ILLEGAL_SERVER_REPLY,
"Probably disconnected");
return NULL;
}
tmp.assign(buf); tmp.assign(buf);
if(tmp.trim() == ""){ if(tmp.trim() == ""){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment