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