summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/AppHdr.h5
-rw-r--r--crawl-ref/source/libunix.cc13
2 files changed, 18 insertions, 0 deletions
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h
index 3a1fb6c7b2..0416da3b05 100644
--- a/crawl-ref/source/AppHdr.h
+++ b/crawl-ref/source/AppHdr.h
@@ -272,6 +272,11 @@
// an error message.
#define DGL_PAUSE_AFTER_ERROR
+ // Enable core dumps. Note that this will not create core dumps if
+ // Crawl is installed setuid or setgid, but dgamelaunch installs should
+ // not be installing Crawl set[ug]id anyway.
+ #define DGL_ENABLE_CORE_DUMP
+
// Use UTC for dgamelaunch servers.
#define TIME_FN gmtime
#endif
diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc
index cd84a7a282..b79b7da691 100644
--- a/crawl-ref/source/libunix.cc
+++ b/crawl-ref/source/libunix.cc
@@ -51,6 +51,11 @@
#include "stuff.h"
#include "view.h"
+#ifdef DGL_ENABLE_CORE_DUMP
+#include <sys/time.h>
+#include <sys/resource.h>
+#endif
+
#ifdef UNICODE_GLYPHS
#include <wchar.h>
#include <locale.h>
@@ -447,6 +452,14 @@ void unixcurses_startup( void )
#endif
+#ifdef DGL_ENABLE_CORE_DUMP
+ rlimit lim;
+ if (!getrlimit(RLIMIT_CORE, &lim)) {
+ lim.rlim_cur = RLIM_INFINITY;
+ setrlimit(RLIMIT_CORE, &lim);
+ }
+#endif
+
initscr();
raw();
noecho();