1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-08 13:44:32 +02:00

Fix check digit chars.

This commit is contained in:
stalkerg 2016-09-09 19:01:36 +03:00
parent 9d273330d3
commit e01d84e9aa

View File

@ -1108,14 +1108,21 @@ add_files(parray *files, const char *root, bool add_root, bool is_pgdata)
file->is_datafile = true;
{
int find_dot;
int check_digit;
char *text_segno;
for(find_dot = path_len-1; file->path[find_dot] != '.' && find_dot >= 0; find_dot--);
if (find_dot <= 0)
continue;
text_segno = file->path + find_dot + 1;
/* in future we will need check all chars */
if (!isdigit(text_segno[0]))
for(check_digit=0; text_segno[check_digit] != '\0'; check_digit++)
if (!isdigit(text_segno[check_digit]))
{
check_digit = -1;
break;
}
if (check_digit == -1)
continue;
file->segno = (int) strtol(text_segno, NULL, 10);