altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.1-corelimit.patch

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