regx/fwd: correctly handle node names with multiple set of digits
Refs. open-mpi/ompi#4689 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
8f02596777
Коммит
a056fdea2d
@ -170,14 +170,12 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex)
|
||||
len = strlen(node);
|
||||
startnum = -1;
|
||||
memset(prefix, 0, ORTE_MAX_NODE_PREFIX);
|
||||
numdigits = 0;
|
||||
for (i=0, j=0; i < len; i++) {
|
||||
/* valid hostname characters are ascii letters, digits and the '-' character. */
|
||||
if (isdigit(node[i])) {
|
||||
/* count the size of the numeric field - but don't
|
||||
* add the digits to the prefix
|
||||
*/
|
||||
numdigits++;
|
||||
if (startnum < 0) {
|
||||
/* okay, this defines end of the prefix */
|
||||
startnum = i;
|
||||
@ -204,8 +202,10 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex)
|
||||
nodenum = strtol(&node[startnum], &sfx, 10);
|
||||
if (NULL != sfx) {
|
||||
suffix = strdup(sfx);
|
||||
numdigits = (int)(sfx - &node[startnum]);
|
||||
} else {
|
||||
suffix = NULL;
|
||||
numdigits = (int)strlen(&node[startnum]);
|
||||
}
|
||||
/* is this node name already on our list? */
|
||||
found = false;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user