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

This commit is contained in:
laishenghao
2023-06-20 20:17:14 +08:00
parent ce4909dc18
commit c1356752b7
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.