Patch to fix cppcheck with newer glibc (#3471)

diff --git a/WORKSPACE b/WORKSPACE
index ac4393f..065d85b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -930,10 +930,12 @@
 
 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(
diff --git a/third_party/cppcheck/cppcheck-readdir-fix.patch b/third_party/cppcheck/cppcheck-readdir-fix.patch
new file mode 100644
index 0000000..bde961a
--- /dev/null
+++ b/third_party/cppcheck/cppcheck-readdir-fix.patch
@@ -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))