Blame SOURCES/httpd-2.4.1-corelimit.patch

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