From 8fbe54b9dcf90baaf59921e7969c626c7975ca2a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Apr 2025 14:31:51 +0800 Subject: [PATCH] avoid rm / dir` Signed-off-by: unknown --- utils/utils_fs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils_fs.cpp b/utils/utils_fs.cpp index 93a9dbeb..28e15433 100644 --- a/utils/utils_fs.cpp +++ b/utils/utils_fs.cpp @@ -100,8 +100,8 @@ int64_t GetFilesFromDirectory(const std::string &path, std::vector bool RemoveDir(const std::string &path) { - if (path.empty()) { - LOG(ERROR) << "input path is empty."; + if (path.empty() || path == "/") { + LOG(ERROR) << "input path is invalid."; return false; } std::string strPath = path; -- Gitee