[icinga-checkins] icinga.org: icinga2/support/2.4: Fix overloaded command pipe errors

git at icinga.org git at icinga.org
Thu May 12 11:50:28 CEST 2016


Module: icinga2
Branch: support/2.4
Commit: b39634d94802f1ad0ec1feb47261a6e01dc987a2
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=b39634d94802f1ad0ec1feb47261a6e01dc987a2

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Mon May  9 16:14:48 2016 +0200

Fix overloaded command pipe errors

fixes #11390

---

 lib/compat/externalcommandlistener.cpp |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/compat/externalcommandlistener.cpp b/lib/compat/externalcommandlistener.cpp
index cc484f1..aac24ec 100644
--- a/lib/compat/externalcommandlistener.cpp
+++ b/lib/compat/externalcommandlistener.cpp
@@ -115,13 +115,18 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath)
 			try {
 				rc = sock->Read(buffer, sizeof(buffer));
 			} catch (const std::exception& ex) {
+				/* We have read all data. */
+				if (errno == EAGAIN)
+					continue;
+
 				Log(LogWarning, "ExternalCommandListener")
-				    << "Cannot read from socket." << DiagnosticInformation(ex);
+				    << "Cannot read from command pipe." << DiagnosticInformation(ex);
 				break;
 			}
 
-			if (rc <= 0)
-				break;
+			/* Empty pipe (EOF) */
+			if (rc == 0)
+				continue;
 
 			fifo->Write(buffer, rc);
 



More information about the icinga-checkins mailing list