Skip to content

Commit 3e49dd1

Browse files
committed
Fix make mkdir.sh if tablespace path have root path.
1 parent c2b2acc commit 3e49dd1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

dir.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,13 @@ dir_print_mkdirs_sh(FILE *out, const parray *files, const char *root)
440440
pgFile *file = (pgFile *) parray_get(files, i);
441441
if (S_ISDIR(file->mode))
442442
{
443-
if (strstr(file->path, root) == file->path) {
444-
fprintf(out, "mkdir -m 700 -p %s\n", file->path + strlen(root)
445-
+ 1);
443+
if (strstr(file->path, root) == file->path &&
444+
*(file->path + strlen(root)) == '/')
445+
{
446+
fprintf(out, "mkdir -m 700 -p %s\n", file->path + strlen(root) + 1);
446447
}
447-
else {
448+
else
449+
{
448450
fprintf(out, "mkdir -m 700 -p %s\n", file->path);
449451
}
450452
}

0 commit comments

Comments
 (0)