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