mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
BUG#27207 Return correct error message when ndb_mgmd start with wrong config.ini parameter in TCP section
This commit is contained in:
parent
cf21cf2c73
commit
fcec5410bf
1 changed files with 29 additions and 4 deletions
|
@ -2889,25 +2889,50 @@ static bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data)
|
|||
char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")];
|
||||
char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")];
|
||||
const char* nodeId;
|
||||
require(ctx.m_currentSection->get(buf, &nodeId));
|
||||
if(!ctx.m_currentSection->get(buf, &nodeId))
|
||||
{
|
||||
ctx.reportError("Mandatory parameter %s missing from section"
|
||||
"[%s] starting at line: %d",
|
||||
buf, ctx.fname, ctx.m_sectionLineno);
|
||||
return false;
|
||||
}
|
||||
|
||||
char tmpLine[MAX_LINE_LENGTH];
|
||||
strncpy(tmpLine, nodeId, MAX_LINE_LENGTH);
|
||||
char* token1 = strtok(tmpLine, ".");
|
||||
char* token2 = strtok(NULL, ".");
|
||||
Uint32 id;
|
||||
|
||||
|
||||
if(!token1)
|
||||
{
|
||||
ctx.reportError("Value for mandatory parameter %s missing from section "
|
||||
"[%s] starting at line: %d",
|
||||
buf, ctx.fname, ctx.m_sectionLineno);
|
||||
return false;
|
||||
}
|
||||
if (token2 == NULL) { // Only a number given
|
||||
errno = 0;
|
||||
char* p;
|
||||
id = strtol(token1, &p, 10);
|
||||
if (errno != 0) warning("STRTOK1", nodeId);
|
||||
if (errno != 0 || id <= 0x0 || id > MAX_NODES)
|
||||
{
|
||||
ctx.reportError("Illegal value for mandatory parameter %s from section "
|
||||
"[%s] starting at line: %d",
|
||||
buf, ctx.fname, ctx.m_sectionLineno);
|
||||
return false;
|
||||
}
|
||||
require(ctx.m_currentSection->put(buf, id, true));
|
||||
} else { // A pair given (e.g. "uppsala.32")
|
||||
errno = 0;
|
||||
char* p;
|
||||
id = strtol(token2, &p, 10);
|
||||
if (errno != 0) warning("STRTOK2", nodeId);
|
||||
if (errno != 0 || id <= 0x0 || id > MAX_NODES)
|
||||
{
|
||||
ctx.reportError("Illegal value for mandatory parameter %s from section "
|
||||
"[%s] starting at line: %d",
|
||||
buf, ctx.fname, ctx.m_sectionLineno);
|
||||
return false;
|
||||
}
|
||||
require(ctx.m_currentSection->put(buf, id, true));
|
||||
require(ctx.m_currentSection->put(sysbuf, token1));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue