Skip to content

Commit 2c6431b

Browse files
ggouaillardetScott Miller
authored andcommitted
regx/fwd: correctly handle node names with multiple set of digits
Refs. #4689 Signed-off-by: Gilles Gouaillardet <[email protected]> (back-ported from commit a056fde) Signed-off-by: Scott Miller <[email protected]>
1 parent 576e138 commit 2c6431b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

orte/util/nidmap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
1616
* Copyright (c) 2014-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
18+
* Copyright (c) 2018 IBM Corporation. All rights reserved.
1819
* $COPYRIGHT$
1920
*
2021
* Additional copyrights may follow
@@ -268,14 +269,12 @@ int orte_util_nidmap_create(opal_pointer_array_t *pool, char **regex)
268269
len = strlen(node);
269270
startnum = -1;
270271
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
271-
numdigits = 0;
272272
for (i=0, j=0; i < len; i++) {
273273
/* valid hostname characters are ascii letters, digits and the '-' character. */
274274
if (isdigit(node[i])) {
275275
/* count the size of the numeric field - but don't
276276
* add the digits to the prefix
277277
*/
278-
numdigits++;
279278
if (startnum < 0) {
280279
/* okay, this defines end of the prefix */
281280
startnum = i;
@@ -302,8 +301,10 @@ int orte_util_nidmap_create(opal_pointer_array_t *pool, char **regex)
302301
nodenum = strtol(&node[startnum], &sfx, 10);
303302
if (NULL != sfx) {
304303
suffix = strdup(sfx);
304+
numdigits = (int)(sfx - &node[startnum]);
305305
} else {
306306
suffix = NULL;
307+
numdigits = (int)strlen(&node[startnum]);
307308
}
308309
/* is this node name already on our list? */
309310
found = false;

0 commit comments

Comments
 (0)