From 06e4da8119e51a7b03387d0b2f82a8ed07e75fe2 Mon Sep 17 00:00:00 2001 From: Butta Date: Mon, 2 Sep 2019 14:59:16 +0530 Subject: [PATCH] tests: for Android, check TMPDIR first in dispatch_io_muxed --- tests/dispatch_io_muxed.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/dispatch_io_muxed.c b/tests/dispatch_io_muxed.c index 99b1d23d9..3b2fd40cf 100644 --- a/tests/dispatch_io_muxed.c +++ b/tests/dispatch_io_muxed.c @@ -55,11 +55,16 @@ test_file_muxed(void) test_ptr_notnull("temporary directory", temp_dir); test_stop(); } - char *path = NULL; - asprintf(&path, "%s\\dispatchtest_io.XXXXXX", temp_dir); + char *path_separator = "\\"; #else - char path[] = "/tmp/dispatchtest_io.XXXXXX"; + char *temp_dir = getenv("TMPDIR"); + if (!temp_dir) { + temp_dir = "/tmp"; + } + char *path_separator = "/"; #endif + char *path = NULL; + asprintf(&path, "%s%sdispatchtest_io.XXXXXX", temp_dir, path_separator); dispatch_fd_t fd = mkstemp(path); if (fd == -1) { test_errno("mkstemp", errno, 0);