From c1356752b7e2bb3ff9a3f9153996500755ab0ccc Mon Sep 17 00:00:00 2001 From: laishenghao Date: Tue, 20 Jun 2023 20:17:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8F=90=E5=89=8D=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=9A=84=E5=9C=BA=E6=99=AF=EF=BC=8C=E5=B0=86=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=8C=87=E9=92=88*ptr=E6=81=A2=E5=A4=8D=E4=B8=BA=E2=80=98/?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gausskernel/optimizer/commands/tablespace.cpp | 7 ++++--- src/test/regress/output/tablespace_1.source | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gausskernel/optimizer/commands/tablespace.cpp b/src/gausskernel/optimizer/commands/tablespace.cpp index 3ca2a56e6d..316bf02c84 100644 --- a/src/gausskernel/optimizer/commands/tablespace.cpp +++ b/src/gausskernel/optimizer/commands/tablespace.cpp @@ -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; } diff --git a/src/test/regress/output/tablespace_1.source b/src/test/regress/output/tablespace_1.source index 5c5e542fd5..593eff37bd 100644 --- a/src/test/regress/output/tablespace_1.source +++ b/src/test/regress/output/tablespace_1.source @@ -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. -- Gitee