Skip to content

Commit eb20759

Browse files
committed
error checking and explanatory comment
1 parent bbbf571 commit eb20759

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/CTINetwork.C

+12-2
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,18 @@ XTNetwork::XTNetwork( bool, /* dummy for distinguising from other constructors *
490490
if( timeOut != -1 )
491491
set_StartupTimeout( timeOut );
492492

493-
// ensure we know our node's hostname
494-
std::string myHost = cti_be_getNodeHostname();
493+
// ensure we know our node's hostname.
494+
// we call cti_be_getNodeHostname instead of XPlat::NetUtils::GetLocalHostName
495+
// because GetLocalHostName forwards to cti_getHostname, which, on shasta,
496+
// will look at the contents of /etc/cray/xname, which won't match what
497+
// we were passed in the topology. getNodeHostname will look at /etc/cray/nid,
498+
// which will match up with the nid00000x form we were passed.
499+
auto myHostCStr = cti_be_getNodeHostname();
500+
if (myHostCStr == nullptr) {
501+
mrn_dbg(1, mrn_printf(FLF, stderr, "Failed to get local hostname.\n"));
502+
exit(1);
503+
}
504+
std::string myHost{myHostCStr};
495505
set_LocalHostName( myHost );
496506

497507
disable_FailureRecovery();

0 commit comments

Comments
 (0)