hmcdrvfs: fix parsing of link count >= 1000

hmcdrvfs will ignore files with a link count >= 1000, due to an inconsistency
in the input data. The parsing code relies on having spaces between the
different fields in its input data. When a file has a link count >= 1000,
there will be no space, and the "link count" field will be placed directly
after the previous "mode" field. This will confuse the parser, and all such
files will not be accesible.

The "mode" field will never contain digits, so in order to fix this issue,
the parser can recognize the "link count" field by the presence of a digit.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Gerald Schaefer
2018-02-20 19:27:11 +01:00
committed by Jan Höppner
parent 811152c08a
commit 983a72dab9
2 changed files with 7 additions and 3 deletions

View File

@@ -821,10 +821,13 @@ static char *hmcdrv_parse_line(char *line, char *namebuf,
if ((*line != '\0') && (*line != '\n')) {
field = hmcdrv_parse_ntoken(field, line, &attr);
while ((*line != '\0') &&
(*line != '\n') &&
!isspace(*line))
while ((*line != '\0') && (*line != '\n')) {
if (isspace(*line))
break;
if (field == 1 && isdigit(*line))
break;
++line; /* search end of field */
}
}
} /* while */