Skip to content

Commit

Permalink
Patch to fix cppcheck with newer glibc (apache#3471)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicknezis authored and thinker0 committed Mar 21, 2020
1 parent d013700 commit cfbd8ff
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 5 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -930,10 +930,12 @@ http_archive(

http_archive(
name = "com_github_danmar_cppcheck",
urls = ["https://github.com/danmar/cppcheck/archive/1.87.zip"],
strip_prefix = "cppcheck-1.87",
build_file = "@//:third_party/cppcheck/cppcheck.BUILD",
sha256 = "b3de7fbdc1a23d7341b55f7f88877e106a76847bd5a07fa721c07310b625318b",
patch_args = ["-p2"],
patches = ["//third_party/cppcheck:cppcheck-readdir-fix.patch"],
sha256 = "cb0e66cbe2d6b655fce430cfaaa74b83ad11c91f221e3926f1ca3211bb7c906b",
strip_prefix = "cppcheck-1.90",
urls = ["https://github.com/danmar/cppcheck/archive/1.90.zip"],
)

http_archive(
Expand Down
12 changes: 12 additions & 0 deletions third_party/cppcheck/cppcheck-readdir-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -Naur cppcheck/cppcheck-1.90/cli/filelister.cpp cppcheck-fixed/cppcheck-1.90/cli/filelister.cpp
--- cppcheck/cppcheck-1.90/cli/filelister.cpp 2020-02-20 22:42:28.000000000 -0500
+++ cppcheck-fixed/cppcheck-1.90/cli/filelister.cpp 2020-02-20 22:44:48.000000000 -0500
@@ -194,7 +194,7 @@
std::string new_path;
new_path.reserve(path.length() + 100);// prealloc some memory to avoid constant new/deletes in loop

- while ((readdir_r(dir, &entry, &dir_result) == 0) && (dir_result != nullptr)) {
+ while ((dir_result = readdir(dir)) != NULL) {

if ((std::strcmp(dir_result->d_name, ".") == 0) ||
(std::strcmp(dir_result->d_name, "..") == 0))

0 comments on commit cfbd8ff

Please sign in to comment.