aboutsummaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2015-02-17 16:15:01 -0500
committerCory Fields <cory-nospam-@coryfields.com>2015-03-19 00:14:28 -0400
commit8752b5c882fb94f223b117153bdac024f1dfb25f (patch)
treed0f8f271c69c9ff66ad9a4f37b48f4abd8024a48 /src/compat
parent601327be8ca971895bef8f3e5cdde86ca220e8d6 (diff)
downloadbitcoin-8752b5c882fb94f223b117153bdac024f1dfb25f.tar.xz
0.10 fix for crashes on OSX 10.6
strnlen is available at build-time but not at runtime, causing a crash. 0.11 drops support for 10.6, so this is not needed in master.
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/strnlen.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compat/strnlen.cpp b/src/compat/strnlen.cpp
index 7f3e159887..7dafd98c0b 100644
--- a/src/compat/strnlen.cpp
+++ b/src/compat/strnlen.cpp
@@ -7,12 +7,11 @@
#endif
#include <cstring>
-
-#if HAVE_DECL_STRNLEN == 0
-size_t strnlen( const char *start, size_t max_len)
+// OSX 10.6 is missing strnlen at runtime, but builds targetting it will still
+// succeed. Define our own version here to avoid a crash.
+size_t strnlen_int( const char *start, size_t max_len)
{
const char *end = (const char *)memchr(start, '\0', max_len);
return end ? (size_t)(end - start) : max_len;
}
-#endif // HAVE_DECL_STRNLEN