httpd-2.4.1-corelimit.patch 1.1 KB

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