summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/IceGridNode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceGrid/IceGridNode.cpp')
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp
index 6042aec32d3..63d85a1c7fe 100644
--- a/cpp/src/IceGrid/IceGridNode.cpp
+++ b/cpp/src/IceGrid/IceGridNode.cpp
@@ -9,6 +9,7 @@
#include <IceUtil/UUID.h>
#include <Ice/Ice.h>
+#include <Ice/ProtocolPluginFacade.h> // Just to get the hostname
#include <Ice/Locator.h>
#include <Ice/Service.h>
#include <IceGrid/Activator.h>
@@ -414,17 +415,12 @@ NodeService::start(int argc, char* argv[])
string name = properties->getProperty("IceGrid.Node.Name");
if(name.empty())
{
- char host[1024 + 1];
- if(gethostname(host, 1024) != 0)
+ string hostname = IceInternal::getProtocolPluginFacade(communicator())->getDefaultHost();
+ if(!nowarn)
{
- syserror("property `IceGrid.Node.Name' is not set and couldn't get the hostname:");
- return false;
- }
- else if(!nowarn)
- {
- warning("property `IceGrid.Node.Name' is not set, using hostname: " + string(host));
+ warning("property `IceGrid.Node.Name' is not set, using hostname: " + hostname);
}
- properties->setProperty("IceGrid.Node.Name", string(host));
+ properties->setProperty("IceGrid.Node.Name", hostname);
}
//
@@ -478,7 +474,7 @@ NodeService::start(int argc, char* argv[])
catch(const Ice::ServerNotFoundException&)
{
}
- catch(const Ice::LocalException& ex)
+ catch(const Ice::LocalException&)
{
}
}