From 27b41a7db4b7cafc62c52c1437beed4b6fb972fc Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 5 Nov 2012 16:59:53 +0000 Subject: [PATCH] If the nodename is an IP address, we need to retain the full name (even if keep_fqdn is false) so that the ssh tree spawn can proceed. cmr:v1.7 This commit was SVN r27561. --- orte/util/nidmap.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/orte/util/nidmap.c b/orte/util/nidmap.c index a969874b3f..2146344ca7 100644 --- a/orte/util/nidmap.c +++ b/orte/util/nidmap.c @@ -243,6 +243,7 @@ int orte_util_encode_nodemap(opal_byte_object_t *boptr, bool update) { orte_node_t *node; int32_t i; + size_t j; int rc; opal_buffer_t buf; char *ptr, *nodename; @@ -292,8 +293,15 @@ int orte_util_encode_nodemap(opal_byte_object_t *boptr, bool update) /* pack the name of the node */ if (!orte_keep_fqdn_hostnames) { nodename = strdup(node->name); - if (NULL != (ptr = strchr(nodename, '.'))) { - *ptr = '\0'; + /* if the nodename is an IP address, do not mess with it! */ + for (j=0; j < strlen(nodename)-1; j++) { + if (isalpha(nodename[j]) && '.' != nodename[j]) { + /* not an IP address */ + if (NULL != (ptr = strchr(nodename, '.'))) { + *ptr = '\0'; + } + break; + } } if (ORTE_SUCCESS != (rc = opal_dss.pack(&buf, &nodename, 1, OPAL_STRING))) { ORTE_ERROR_LOG(rc);