blob: 18e4107ec76b1a9219708444edaedfbef60b5cf5 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001
2Bump up the core size limit if CoreDumpDirectory is
3configured.
4
5Upstream-Status: Pending
6
7Note: upstreaming was discussed but there are competing desires;
8 there are portability oddities here too.
9
10--- httpd-2.4.1/server/core.c.corelimit
11+++ httpd-2.4.1/server/core.c
12@@ -4433,6 +4433,25 @@ static int core_post_config(apr_pool_t *
13 }
14 apr_pool_cleanup_register(pconf, NULL, ap_mpm_end_gen_helper,
15 apr_pool_cleanup_null);
16+
17+#ifdef RLIMIT_CORE
18+ if (ap_coredumpdir_configured) {
19+ struct rlimit lim;
20+
21+ if (getrlimit(RLIMIT_CORE, &lim) == 0 && lim.rlim_cur == 0) {
22+ lim.rlim_cur = lim.rlim_max;
23+ if (setrlimit(RLIMIT_CORE, &lim) == 0) {
24+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
25+ "core dump file size limit raised to %lu bytes",
26+ lim.rlim_cur);
27+ } else {
28+ ap_log_error(APLOG_MARK, APLOG_NOTICE, errno, NULL,
29+ "core dump file size is zero, setrlimit failed");
30+ }
31+ }
32+ }
33+#endif
34+
35 return OK;
36 }
37