From afebe63313e23692a3add97391e6c2019d0df5cd Mon Sep 17 00:00:00 2001 From: lvyuanyuan Date: Tue, 23 May 2023 11:52:56 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E6=96=87=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E3=80=91=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E5=88=A0=E9=99=A4=E6=97=B6=E5=88=A0=E9=99=A4=E6=95=B4?= =?UTF-8?q?=E4=B8=AA=E7=9B=AE=E5=BD=95=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lvyuanyuan Change-Id: Iecb859dd82e8c976268a8b4199834c576c0b6e66 --- .../innerkits/native/file_share/src/file_share.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/interfaces/innerkits/native/file_share/src/file_share.cpp b/interfaces/innerkits/native/file_share/src/file_share.cpp index be352eafd..c10524dbd 100644 --- a/interfaces/innerkits/native/file_share/src/file_share.cpp +++ b/interfaces/innerkits/native/file_share/src/file_share.cpp @@ -116,6 +116,7 @@ static int32_t GetLowerPath(string &lowerPathHead, const string &lowerPathTail, return -EINVAL; } if (lowerPathHead.find(PID_FLAG) != string::npos) { + pid.erase(pid.size() - 1); lowerPathHead = lowerPathHead.replace(lowerPathHead.find(PID_FLAG), PID_FLAG.length(), pid); } @@ -347,11 +348,15 @@ static void UmountDelUris(vector sharePathList, string currentUid, strin if (umount2(delRPath.c_str(), MNT_DETACH) != 0) { LOGE("UmountdelRPath, umount failed with %{public}d", errno); } + + remove(delRPath.c_str()); } if (access(delRWPath.c_str(), F_OK) == 0) { if (umount2(delRWPath.c_str(), MNT_DETACH) != 0) { LOGE("UmountdelRWPath, umount failed with %{public}d", errno); } + + remove(delRWPath.c_str()); } } } @@ -366,12 +371,6 @@ int32_t FileShare::DeleteShareFile(uint32_t tokenId, vector sharePathLis } UmountDelUris(sharePathList, currentUid, bundleName); - string sharePath = DATA_APP_EL2_PATH + currentUid + SHARE_PATH + bundleName; - if ((access(sharePath.c_str(), F_OK) == 0) && !DeleteDir(sharePath)) { - LOGE("Delete dir failed with %{public}d", errno); - return -errno; - } - LOGI("Delete Share File Successfully!"); return 0; } -- Gitee From 6bc661416f66d57ec3290557b87cdff6353f82f8 Mon Sep 17 00:00:00 2001 From: lvyuanyuan Date: Tue, 23 May 2023 12:38:42 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E6=96=87=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E3=80=91=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E5=88=A0=E9=99=A4=E6=97=B6=E5=88=A0=E9=99=A4=E6=95=B4?= =?UTF-8?q?=E4=B8=AA=E7=9B=AE=E5=BD=95=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lvyuanyuan Change-Id: I88519440c52ec4d76acd7b4fcf78d08b2ad81fad --- interfaces/innerkits/native/file_share/src/file_share.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/interfaces/innerkits/native/file_share/src/file_share.cpp b/interfaces/innerkits/native/file_share/src/file_share.cpp index c10524dbd..674a3516b 100644 --- a/interfaces/innerkits/native/file_share/src/file_share.cpp +++ b/interfaces/innerkits/native/file_share/src/file_share.cpp @@ -267,14 +267,6 @@ static bool RemoveDir(const string& path) return true; } -static bool DeleteDir(const string &path) -{ - if (IsExistDir(path)) { - return RemoveDir(path); - } - return false; -} - static int32_t PreparePreShareDir(FileShareInfo &info) { for (size_t i = 0; i < info.sharePath_.size(); i++) { -- Gitee