[PATCH] D69135: CloexecDupCheck: Always pass the third argument

Stephen Gallagher via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 13:50:31 PDT 2019


sgallagher created this revision.
sgallagher added a reviewer: llvm-commits.
sgallagher added a project: clang-tools-extra.
Herald added a project: LLVM.

When running valgrind, the third argument is read implicitly from
the stack, resulting in an EINVAL return from the fcntl(). We should
explicitly be setting the third argument to zero to ensure that we
don't break valgrind.

Signed-off-by: Stephen Gallagher <sgallagh at redhat.com>


Repository:
  rL LLVM

https://reviews.llvm.org/D69135

Files:
  clang-tools-extra/clang-tidy/android/CloexecDupCheck.cpp


Index: clang-tools-extra/clang-tidy/android/CloexecDupCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/android/CloexecDupCheck.cpp
+++ clang-tools-extra/clang-tidy/android/CloexecDupCheck.cpp
@@ -24,7 +24,7 @@
 
 void CloexecDupCheck::check(const MatchFinder::MatchResult &Result) {
   std::string ReplacementText =
-      (Twine("fcntl(") + getSpellingArg(Result, 0) + ", F_DUPFD_CLOEXEC)")
+      (Twine("fcntl(") + getSpellingArg(Result, 0) + ", F_DUPFD_CLOEXEC, 0)")
           .str();
 
   replaceFunc(Result,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69135.225511.patch
Type: text/x-patch
Size: 577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191017/eeaf1cad/attachment.bin>


More information about the llvm-commits mailing list