This commit is contained in:
Jean-Francois Dockes 2020-03-25 16:55:34 +01:00
parent 207bfec93e
commit 023bdc055e

View File

@ -86,7 +86,7 @@ bool CmdTalk::startCmd(const string& cmdname,
const vector<string>& env, const vector<string>& env,
const vector<string>& path) const vector<string>& path)
{ {
LOGDEB("CmdTalk::startCmd\n" ); LOGDEB("CmdTalk::startCmd\n");
delete m->cmd; delete m->cmd;
m->cmd = new ExecCmd; m->cmd = new ExecCmd;
@ -128,7 +128,7 @@ bool CmdTalk::Internal::readDataElement(string& name, string &data)
try { try {
// Read name and length // Read name and length
if (cmd->getline(ibuf) <= 0) { if (cmd->getline(ibuf) <= 0) {
LOGERR("CmdTalk: getline error\n" ); LOGERR("CmdTalk: getline error\n");
return false; return false;
} }
} catch (TimeoutExcept) { } catch (TimeoutExcept) {
@ -137,11 +137,11 @@ bool CmdTalk::Internal::readDataElement(string& name, string &data)
return false; return false;
} }
LOGDEB1("CmdTalk:rde: line [" << (ibuf) << "]\n" ); LOGDEB1("CmdTalk:rde: line [" << ibuf << "]\n");
// Empty line (end of message) ? // Empty line (end of message) ?
if (!ibuf.compare("\n")) { if (!ibuf.compare("\n")) {
LOGDEB("CmdTalk: Got empty line\n" ); LOGDEB1("CmdTalk: Got empty line\n");
return true; return true;
} }
@ -149,7 +149,7 @@ bool CmdTalk::Internal::readDataElement(string& name, string &data)
vector<string> tokens; vector<string> tokens;
stringToTokens(ibuf, tokens); stringToTokens(ibuf, tokens);
if (tokens.size() != 2) { if (tokens.size() != 2) {
LOGERR("CmdTalk: bad line in filter output: [" << (ibuf) << "]\n" ); LOGERR("CmdTalk: bad line in filter output: [" << ibuf << "]\n");
return false; return false;
} }
vector<string>::iterator it = tokens.begin(); vector<string>::iterator it = tokens.begin();
@ -157,7 +157,7 @@ bool CmdTalk::Internal::readDataElement(string& name, string &data)
string& slen = *it; string& slen = *it;
int len; int len;
if (sscanf(slen.c_str(), "%d", &len) != 1) { if (sscanf(slen.c_str(), "%d", &len) != 1) {
LOGERR("CmdTalk: bad line in filter output: [" << (ibuf) << "]\n" ); LOGERR("CmdTalk: bad line in filter output: [" << ibuf << "]\n");
return false; return false;
} }
@ -194,12 +194,12 @@ bool CmdTalk::Internal::talk(const pair<string, string>& arg0,
if (cmd->send(obuf.str()) < 0) { if (cmd->send(obuf.str()) < 0) {
cmd->zapChild(); cmd->zapChild();
LOGERR("CmdTalk: send error\n" ); LOGERR("CmdTalk: send error\n");
return false; return false;
} }
// Read answer (multiple elements) // Read answer (multiple elements)
LOGDEB1("CmdTalk: reading answer\n" ); LOGDEB1("CmdTalk: reading answer\n");
for (;;) { for (;;) {
string name, data; string name, data;
if (!readDataElement(name, data)) { if (!readDataElement(name, data)) {