From: Minh Diep Date: Mon, 7 Nov 2011 17:23:38 +0000 (-0800) Subject: LU-737 utils: check device name for digit X-Git-Tag: v1_8_7_81_WC1~44 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=8089ee261a08a1bc38c214c90edae08e71cd7727;p=fs%2Flustre-release.git LU-737 utils: check device name for digit We need to check the whole string for digit not only the first character Signed-off-by: Minh Diep Change-Id: Ib3002f2f8dd9c657d7bcfcfa9166488c080152c2 Reviewed-on: http://review.whamcloud.com/1660 Reviewed-by: wangdi Reviewed-by: Yu Jian Tested-by: Hudson Tested-by: Maloo Reviewed-by: Johann Lombardi --- diff --git a/lustre/utils/lustre_cfg.c b/lustre/utils/lustre_cfg.c index 20de727..e8e9dab 100644 --- a/lustre/utils/lustre_cfg.c +++ b/lustre/utils/lustre_cfg.c @@ -77,13 +77,26 @@ static char * lcfg_devname; int lcfg_set_devname(char *name) { + char *ptr; + int digit = 1; + if (name) { if (lcfg_devname) free(lcfg_devname); /* quietly strip the unnecessary '$' */ if (*name == '$' || *name == '%') name++; - if (isdigit(*name)) { + + ptr = name; + while (*ptr != '\0') { + if (!isdigit(*ptr)) { + digit = 0; + break; + } + ptr++; + } + + if (digit) { /* We can't translate from dev # to name */ lcfg_devname = NULL; } else {