summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Tests/2017-12-11-13-31-33.bpo-32252.YnFw7J.rst2
-rw-r--r--Modules/faulthandler.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Tests/2017-12-11-13-31-33.bpo-32252.YnFw7J.rst b/Misc/NEWS.d/next/Tests/2017-12-11-13-31-33.bpo-32252.YnFw7J.rst
new file mode 100644
index 0000000000..ee4c56bb73
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2017-12-11-13-31-33.bpo-32252.YnFw7J.rst
@@ -0,0 +1,2 @@
+Fix faulthandler_suppress_crash_report() used to prevent core dump files
+when testing crashes. getrlimit() returns zero on success.
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 0e85cce132..baa2e91770 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -932,7 +932,7 @@ faulthandler_suppress_crash_report(void)
struct rlimit rl;
/* Disable creation of core dump */
- if (getrlimit(RLIMIT_CORE, &rl) != 0) {
+ if (getrlimit(RLIMIT_CORE, &rl) == 0) {
rl.rlim_cur = 0;
setrlimit(RLIMIT_CORE, &rl);
}