From 3f874dd147e1a4d638a53b6d0d38019115eaca52 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Thu, 17 Dec 2015 09:54:52 +0100 Subject: [PATCH] don't use tmpfile(), it's broken on windows --- tool/tests/test_inout.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tool/tests/test_inout.c b/tool/tests/test_inout.c index 6a62906..4e05679 100644 --- a/tool/tests/test_inout.c +++ b/tool/tests/test_inout.c @@ -35,14 +35,18 @@ #include "util.h" static void test_inout(enum enum_format format) { - unsigned char buf[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; + const unsigned char buf[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; unsigned char buf2[sizeof(buf)]; - FILE *tmp = tmpfile(); + char filename[] = "/tmp/pivtool_test_XXXXXX"; + int fd = mkstemp(filename); + FILE *tmp = fdopen(fd, "r+"); dump_data(buf, sizeof(buf), tmp, false, format); rewind(tmp); read_data(buf2, sizeof(buf2), tmp, format); assert(memcmp(buf, buf2, sizeof(buf)) == 0); + fclose(tmp); + remove(filename); } int main(void) {