Skip to content

Commit 31ae3ea

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]> (cherry picked from commit a056fde)
1 parent fb8cf63 commit 31ae3ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

orte/mca/regx/fwd/regx_fwd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,12 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex)
170170
len = strlen(node);
171171
startnum = -1;
172172
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
173-
numdigits = 0;
174173
for (i=0, j=0; i < len; i++) {
175174
/* valid hostname characters are ascii letters, digits and the '-' character. */
176175
if (isdigit(node[i])) {
177176
/* count the size of the numeric field - but don't
178177
* add the digits to the prefix
179178
*/
180-
numdigits++;
181179
if (startnum < 0) {
182180
/* okay, this defines end of the prefix */
183181
startnum = i;
@@ -204,8 +202,10 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex)
204202
nodenum = strtol(&node[startnum], &sfx, 10);
205203
if (NULL != sfx) {
206204
suffix = strdup(sfx);
205+
numdigits = (int)(sfx - &node[startnum]);
207206
} else {
208207
suffix = NULL;
208+
numdigits = (int)strlen(&node[startnum]);
209209
}
210210
/* is this node name already on our list? */
211211
found = false;

0 commit comments

Comments
 (0)