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