diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-19 07:57:16 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-19 07:57:26 +0100 |
commit | 10c09f98b2c29516aa5f71d7f9dc0e24145baccc (patch) | |
tree | d0f8f271c69c9ff66ad9a4f37b48f4abd8024a48 /src/compat/strnlen.cpp | |
parent | 601327be8ca971895bef8f3e5cdde86ca220e8d6 (diff) | |
parent | 8752b5c882fb94f223b117153bdac024f1dfb25f (diff) |
Merge pull request #5926
8752b5c 0.10 fix for crashes on OSX 10.6 (Cory Fields)
Diffstat (limited to 'src/compat/strnlen.cpp')
-rw-r--r-- | src/compat/strnlen.cpp | 7 |
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 |