From 7aaa5abffd251468293fa1b35d527334759dfe72 Mon Sep 17 00:00:00 2001 From: Alex Antonov Date: Tue, 25 Jan 2022 17:43:31 +0300 Subject: [PATCH] [mapleall][driver] Fix remark from CodeDex static analyzer CID 98928871: (AssertUsedAtRuntime) Variable 'len' is the return value of function 'readlink'. The return value of system or dorpa library function cannot be verified within ASSERT. --- src/mapleall/maple_driver/src/file_utils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mapleall/maple_driver/src/file_utils.cpp b/src/mapleall/maple_driver/src/file_utils.cpp index 2eab48fc85..a2d9ea466b 100644 --- a/src/mapleall/maple_driver/src/file_utils.cpp +++ b/src/mapleall/maple_driver/src/file_utils.cpp @@ -93,7 +93,10 @@ std::string FileUtils::GetExecutable() { const char *symLinkToCurrentExe = "/proc/self/exe"; int len = static_cast(readlink(symLinkToCurrentExe, exePath, sizeof(exePath))); - ASSERT(len >= 0, "Something wrong: %d, Not Linux System??\n", len); + if (len < 0) { + LogInfo::MapleLogger(kLlErr) << "Currently toolchain supports only Linux System\n"; + return ""; + } /* Add Null terminate for the string: readlink does not * append a terminating null byte to buf */ -- Gitee