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