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