Blame SOURCES/httpd-2.4.35-corelimit.patch

e71654
e71654
Bump up the core size limit if CoreDumpDirectory is
e71654
configured.
e71654
e71654
Upstream-Status: Was discussed but there are competing desires;
e71654
	there are portability oddities here too.
e71654
e71654
diff --git a/server/core.c b/server/core.c
e71654
index aa62e15..ec74029 100644
e71654
--- a/server/core.c
e71654
+++ b/server/core.c
e71654
@@ -4952,6 +4952,25 @@ static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte
e71654
     }
e71654
     apr_pool_cleanup_register(pconf, NULL, ap_mpm_end_gen_helper,
e71654
                               apr_pool_cleanup_null);
e71654
+
e71654
+#ifdef RLIMIT_CORE
e71654
+    if (ap_coredumpdir_configured) {
e71654
+        struct rlimit lim;
e71654
+
e71654
+        if (getrlimit(RLIMIT_CORE, &lim) == 0 && lim.rlim_cur == 0) {
e71654
+            lim.rlim_cur = lim.rlim_max;
e71654
+            if (setrlimit(RLIMIT_CORE, &lim) == 0) {
e71654
+                ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
e71654
+                             "core dump file size limit raised to %lu bytes",
e71654
+                             lim.rlim_cur);
e71654
+            } else {
e71654
+                ap_log_error(APLOG_MARK, APLOG_NOTICE, errno, NULL,
e71654
+                             "core dump file size is zero, setrlimit failed");
e71654
+            }
e71654
+        }
e71654
+    }
e71654
+#endif
e71654
+
e71654
     return OK;
e71654
 }
e71654