blob: ae4ff0c5ec6f4ece631ec499aeb7fd610aec1a18 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 55ebb07cc57854cbfb372c3a688365039b809bc8 Mon Sep 17 00:00:00 2001
2From: Paul Eggleton <paul.eggleton@linux.intel.com>
3Date: Tue, 17 Jul 2012 11:27:39 +0100
4Subject: [PATCH] apache2: add from OE-Classic, update to version 2.4.2 and fix
Patrick Williamsb48b7b42016-08-17 15:04:38 -05005
6Bump up the core size limit if CoreDumpDirectory is
7configured.
8
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08009Upstream-Status: Pending
Patrick Williamsb48b7b42016-08-17 15:04:38 -050010
11Note: upstreaming was discussed but there are competing desires;
12 there are portability oddities here too.
13
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080014---
15 server/core.c | 19 +++++++++++++++++++
16 1 file changed, 19 insertions(+)
17
18diff --git a/server/core.c b/server/core.c
19index 4af0816..4fd2b9f 100644
20--- a/server/core.c
21+++ b/server/core.c
22@@ -4940,6 +4940,25 @@ static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte
Patrick Williamsb48b7b42016-08-17 15:04:38 -050023 }
24 apr_pool_cleanup_register(pconf, NULL, ap_mpm_end_gen_helper,
25 apr_pool_cleanup_null);
26+
27+#ifdef RLIMIT_CORE
28+ if (ap_coredumpdir_configured) {
29+ struct rlimit lim;
30+
31+ if (getrlimit(RLIMIT_CORE, &lim) == 0 && lim.rlim_cur == 0) {
32+ lim.rlim_cur = lim.rlim_max;
33+ if (setrlimit(RLIMIT_CORE, &lim) == 0) {
34+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
35+ "core dump file size limit raised to %lu bytes",
36+ lim.rlim_cur);
37+ } else {
38+ ap_log_error(APLOG_MARK, APLOG_NOTICE, errno, NULL,
39+ "core dump file size is zero, setrlimit failed");
40+ }
41+ }
42+ }
43+#endif
44+
45 return OK;
46 }
47