diff options
author | Gordon Sim <gsim@apache.org> | 2008-05-13 16:44:59 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-05-13 16:44:59 +0000 |
commit | f3757f460aa0a3f25e8a25da31948feb68f9c56b (patch) | |
tree | a5130e1f9727cde914ccd16e61fd1dd6461291ba | |
parent | 8d203e78f21a706efb1bd464f8c8758e2d57bd63 (diff) | |
download | qpid-python-f3757f460aa0a3f25e8a25da31948feb68f9c56b.tar.gz |
QPID-1054: Fixed reporting of startup failures in daemon mode.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@655944 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/src/qpid/broker/Daemon.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/cpp/src/qpid/broker/Daemon.cpp b/cpp/src/qpid/broker/Daemon.cpp index a42f503708..0c2092021f 100644 --- a/cpp/src/qpid/broker/Daemon.cpp +++ b/cpp/src/qpid/broker/Daemon.cpp @@ -118,11 +118,13 @@ void Daemon::fork() } catch (const exception& e) { QPID_LOG(critical, "Daemon startup failed: " << e.what()); - stringstream pipeFailureMessage; - pipeFailureMessage << "0 " << e.what() << endl; + uint16_t port = 0; + write(pipeFds[1], &port, sizeof(uint16_t)); + + std::string pipeFailureMessage = e.what(); write ( pipeFds[1], - pipeFailureMessage.str().c_str(), - strlen(pipeFailureMessage.str().c_str()) + pipeFailureMessage.c_str(), + strlen(pipeFailureMessage.c_str()) ); } } @@ -176,11 +178,11 @@ uint16_t Daemon::wait(int timeout) { // parent waits for child. // Get Message string errmsg; - while ( 1 ) { - if ( 1 > ::read(pipeFds[0], &c, 1) ) - throw Exception("Daemon startup failed"+ - (errmsg.empty() ? string(".") : ": " + errmsg)); - } + do { + errmsg += c; + } while (::read(pipeFds[0], &c, 1)); + throw Exception("Daemon startup failed"+ + (errmsg.empty() ? string(".") : ": " + errmsg)); } return port; |