[compiler-rt] [compiler-rt] Avoid generating coredumps when piped to a tool (PR #83701)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 15:30:59 PST 2024


================
@@ -103,9 +103,28 @@ static void setlim(int res, rlim_t lim) {
 }
 
 void DisableCoreDumperIfNecessary() {
+  rlimit rlim;
+  CHECK_EQ(0, getrlimit(RLIMIT_CORE, &rlim));
   if (common_flags()->disable_coredump) {
-    setlim(RLIMIT_CORE, 0);
+#  ifdef __linux__
----------------
vitalybuka wrote:

usually we do SANITIZER_LINUX


maybe just `rlim.rlim_cur = Min<rlim_t>(SANITIZER_LINUX ? 1 : 0, rlim.rlim_max);`

https://github.com/llvm/llvm-project/pull/83701


More information about the llvm-commits mailing list