aboutsummaryrefslogtreecommitdiff
path: root/src/common/android/testing
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/android/testing')
-rw-r--r--src/common/android/testing/mkdtemp.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/common/android/testing/mkdtemp.h b/src/common/android/testing/mkdtemp.h
index 85644c9f..b86e2cd7 100644
--- a/src/common/android/testing/mkdtemp.h
+++ b/src/common/android/testing/mkdtemp.h
@@ -27,9 +27,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Android doesn't provide mkdtemp(). Keep this implementation in an
-// C++ anonymous namespace to avoid conflicts on Chromium (which
-// already provides an extern "C" mkdtemp function).
+// mkdtemp() wasn't declared in <stdlib.h> until NDK r9b due to a simple
+// packaging bug (the function has always been implemented in all versions
+// of the C library). This header is provided to build Breakpad with earlier
+// NDK revisions (e.g. the one used by Chromium). It may be removed in the
+// future once all major projects upgrade to use a more recent NDK.
//
// The reason this is inlined here is to avoid linking a new object file
// into each unit test program (i.e. keep build files simple).
@@ -44,9 +46,14 @@
#include <string.h>
#include <sys/stat.h>
+// Using a macro renaming trick here is necessary when building against
+// NDK r9b. Otherwise the compiler will complain that calls to mkdtemp()
+// are ambiguous.
+#define mkdtemp breakpad_mkdtemp
+
namespace {
-char* mkdtemp(char* path) {
+char* breakpad_mkdtemp(char* path) {
if (path == NULL) {
errno = EINVAL;
return NULL;