mirror of https://github.com/Icinga/icinga2.git
ExternalCommandListener: Fix crash when reading from socket
refs #10700
This commit is contained in:
parent
a51e647cc7
commit
4ce43b8d02
|
@ -110,7 +110,16 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath)
|
||||||
sock->Poll(true, false);
|
sock->Poll(true, false);
|
||||||
|
|
||||||
char buffer[8192];
|
char buffer[8192];
|
||||||
size_t rc = sock->Read(buffer, sizeof(buffer));
|
size_t rc;
|
||||||
|
|
||||||
|
try {
|
||||||
|
rc = sock->Read(buffer, sizeof(buffer));
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
Log(LogWarning, "ExternalCommandListener")
|
||||||
|
<< "Cannot read from socket." << DiagnosticInformation(ex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (rc <= 0)
|
if (rc <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue