Skip to content

Commit ccc2fcd

Browse files
author
Ralph Castain
authored
Merge pull request #4627 from ggouaillardet/topic/nidmap
orte/nidmap: correctly handle '-' as a valid hostname character
2 parents e9f4e93 + f3e2a31 commit ccc2fcd

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

orte/util/nidmap.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -270,22 +270,15 @@ int orte_util_nidmap_create(opal_pointer_array_t *pool, char **regex)
270270
}
271271
}
272272
node = nptr->name;
273-
/* determine this node's prefix by looking for first non-alpha char */
273+
/* determine this node's prefix by looking for first digit char */
274274
fullname = false;
275275
len = strlen(node);
276276
startnum = -1;
277277
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
278278
numdigits = 0;
279279
for (i=0, j=0; i < len; i++) {
280-
if (!isalpha(node[i])) {
281-
/* found a non-alpha char */
282-
if (!isdigit(node[i])) {
283-
/* if it is anything but a digit, we just use
284-
* the entire name
285-
*/
286-
fullname = true;
287-
break;
288-
}
280+
/* valid hostname characters are ascii letters, digits and the '-' character. */
281+
if (isdigit(node[i])) {
289282
/* count the size of the numeric field - but don't
290283
* add the digits to the prefix
291284
*/
@@ -296,6 +289,13 @@ int orte_util_nidmap_create(opal_pointer_array_t *pool, char **regex)
296289
}
297290
continue;
298291
}
292+
if ('.' == node[i]) {
293+
/* just use the entire name */
294+
fullname = true;
295+
break;
296+
}
297+
/* this is either an alpha or '-' */
298+
assert(isalpha(node[i]) || '-' == node[i]);
299299
if (startnum < 0) {
300300
prefix[j++] = node[i];
301301
}

0 commit comments

Comments
 (0)