From bd52cde3b6512994f4e45448c47d7a393549a55d Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Mon, 8 May 2017 13:02:44 +0300 Subject: [PATCH] Workarounds for Android and some other OSes that are pre 2003 POSIX --- include/boost/stacktrace/detail/safe_dump_posix.ipp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/include/boost/stacktrace/detail/safe_dump_posix.ipp b/include/boost/stacktrace/detail/safe_dump_posix.ipp index a091bc3..37eef5a 100644 --- a/include/boost/stacktrace/detail/safe_dump_posix.ipp +++ b/include/boost/stacktrace/detail/safe_dump_posix.ipp @@ -33,7 +33,17 @@ std::size_t dump(int fd, const native_frame_ptr_t* frames, std::size_t frames_co } std::size_t dump(const char* file, const native_frame_ptr_t* frames, std::size_t frames_count) BOOST_NOEXCEPT { - const int fd = ::open(file, O_CREAT | O_WRONLY | O_TRUNC, S_IWUSR | S_IRUSR); + const int fd = ::open( + file, + O_CREAT | O_WRONLY | O_TRUNC, +#if defined(S_IWUSR) && defined(S_IRUSR) // Workarounds for some Android OSes + S_IWUSR | S_IRUSR +#elif defined(S_IWRITE) && defined(S_IREAD) + S_IWRITE | S_IREAD +#else + 0 +#endif + ); if (fd == -1) { return 0; }