Blame SOURCES/httpd-2.4.35-corelimit.patch

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