Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c509ae4

Browse files
committed
backup: sanity check that external directories do not overlap
1 parent 323add2 commit c509ae4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/backup.c

+24
Original file line numberDiff line numberDiff line change
@@ -3494,6 +3494,30 @@ check_external_for_tablespaces(parray *external_list)
34943494
}
34953495
}
34963496
PQclear(res);
3497+
3498+
/* Check that external directories do not overlap */
3499+
if (parray_num(external_list) < 2)
3500+
return;
3501+
3502+
for (i = 0; i < parray_num(external_list); i++)
3503+
{
3504+
char *external_path = parray_get(external_list, i);
3505+
3506+
for (j = 0; j < parray_num(external_list); j++)
3507+
{
3508+
char *tmp_external_path = parray_get(external_list, j);
3509+
3510+
/* skip yourself */
3511+
if (j == i)
3512+
continue;
3513+
3514+
if (path_is_prefix_of_path(external_path, tmp_external_path))
3515+
elog(ERROR, "External directory path (-E option) \"%s\" "
3516+
"contain another external directory \"%s\"",
3517+
external_path, tmp_external_path);
3518+
3519+
}
3520+
}
34973521
}
34983522

34993523
/* Get index list for given database */

0 commit comments

Comments
 (0)