!3604 【bugfixed】对提前返回的场景,将路径指针*ptr恢复为‘/’

Merge pull request !3604 from laishenghao/symlink
This commit is contained in:
opengauss_bot
2023-06-20 12:43:54 +00:00
committed by Gitee
2 changed files with 5 additions and 4 deletions

View File

@ -2503,11 +2503,12 @@ bool IsPathContainsSymlink(char* path)
*ptr = '\0';
rc = memset_s(&statbuf, sizeof(statbuf), 0, sizeof(statbuf));
if (rc != EOK) {
continue;
}
securec_check(rc, "\0", "\0");
if (lstat(path, &statbuf) == 0 && S_ISLNK(statbuf.st_mode)) {
if (!isLast) {
*ptr = '/';
}
return true;
}

View File

@ -277,5 +277,5 @@ ERROR: location "@testtablespace@/symlink/sym2" is symbolic link
\! ln -s @testtablespace@/symlink/will_delete @testtablespace@/symlink/will_delete_link
\! rm -rf @testtablespace@/symlink/will_delete
CREATE TABLESPACE deleted_symlink LOCATION '@testtablespace@/symlink/will_delete_link/local';
ERROR: recheck location "@testtablespace@/symlink/will_delete_link" exeed max times.
ERROR: recheck location "@testtablespace@/symlink/will_delete_link/local" exeed max times.
DETAIL: the location contains symbolic link, the linked path likely has been deleted.