Skip to content

Commit 06e4da8

Browse files
committed
tests: for Android, check TMPDIR first in dispatch_io_muxed
1 parent 90a45ce commit 06e4da8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/dispatch_io_muxed.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,16 @@ test_file_muxed(void)
5555
test_ptr_notnull("temporary directory", temp_dir);
5656
test_stop();
5757
}
58-
char *path = NULL;
59-
asprintf(&path, "%s\\dispatchtest_io.XXXXXX", temp_dir);
58+
char *path_separator = "\\";
6059
#else
61-
char path[] = "/tmp/dispatchtest_io.XXXXXX";
60+
char *temp_dir = getenv("TMPDIR");
61+
if (!temp_dir) {
62+
temp_dir = "/tmp";
63+
}
64+
char *path_separator = "/";
6265
#endif
66+
char *path = NULL;
67+
asprintf(&path, "%s%sdispatchtest_io.XXXXXX", temp_dir, path_separator);
6368
dispatch_fd_t fd = mkstemp(path);
6469
if (fd == -1) {
6570
test_errno("mkstemp", errno, 0);

0 commit comments

Comments
 (0)