From f054feba85fad9b4e2db5feb05a1afb687e083b8 Mon Sep 17 00:00:00 2001 From: andymacg <117683405+andymacg@users.noreply.github.com> Date: Thu, 5 Oct 2023 05:44:48 -0400 Subject: [PATCH] Fix #12015 by adding pid to filelist name (#5491) --- lib/cppcheck.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 7d198f582..b064853ee 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -383,7 +383,8 @@ static std::vector executeAddon(const AddonInfo &addonInfo, if (!premiumArgs.empty() && !addonInfo.executable.empty()) args += " " + premiumArgs; - const std::string fileArg = (endsWith(file, FILELIST, sizeof(FILELIST)-1) ? " --file-list " : " ") + cmdFileName(file); + const bool is_file_list = (file.find(FILELIST) != std::string::npos); + const std::string fileArg = (is_file_list ? " --file-list " : " ") + cmdFileName(file); args += fileArg; std::string result; @@ -1492,7 +1493,7 @@ void CppCheck::executeAddons(const std::vector& files) std::string fileList; if (files.size() >= 2 || endsWith(files[0], ".ctu-info")) { - fileList = Path::getPathFromFilename(files[0]) + FILELIST; + fileList = Path::getPathFromFilename(files[0]) + FILELIST + std::to_string(getPid()); filesDeleter.addFile(fileList); std::ofstream fout(fileList); for (const std::string& f: files)