summaryrefslogtreecommitdiffstats
path: root/src/OSSupport
diff options
context:
space:
mode:
authorlinnemannr <linnemannr@gmail.com>2015-05-30 10:23:57 +0200
committerlinnemannr <linnemannr@gmail.com>2015-05-30 10:23:57 +0200
commitee34e7131a5a7a308fe431c44741d68a10bb2625 (patch)
tree8f72bc78944f08e0287bf9c782c8152a138a6489 /src/OSSupport
parentMerge pull request #2166 from SafwatHalaby/squid (diff)
downloadcuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.gz
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.bz2
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.lz
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.xz
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.zst
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.zip
Diffstat (limited to '')
-rw-r--r--src/OSSupport/StackTrace.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/OSSupport/StackTrace.cpp b/src/OSSupport/StackTrace.cpp
index 015a53ba0..1ec10f20e 100644
--- a/src/OSSupport/StackTrace.cpp
+++ b/src/OSSupport/StackTrace.cpp
@@ -12,6 +12,13 @@
#include <unistd.h>
#endif
+// FreeBSD uses size_t for the return type of backtrace()
+#if defined(__FreeBSD__) && (__FreeBSD__ >= 10)
+ #define btsize size_t
+#else
+ #define btsize int
+#endif
+
@@ -34,7 +41,7 @@ void PrintStackTrace(void)
// Use the backtrace() function to get and output the stackTrace:
// Code adapted from http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes
void * stackTrace[30];
- int numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
+ btsize numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
#endif
}