From 556d35af88f01ba8cb6019de3a54e30e3f7f59d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 16 Jun 2013 16:42:01 +0200 Subject: [PATCH] tests: Don't rely on $TMPDIR and /tmp on Windows. * test-suite/standalone/test-unwind.c (check_ports)[__MINGW32__]: Use $TEMP, $TMP, or / as the value for TMPDIR. Patch by Eli Zaretskii . --- test-suite/standalone/test-unwind.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test-suite/standalone/test-unwind.c b/test-suite/standalone/test-unwind.c index cf56a9658..3aa3e159d 100644 --- a/test-suite/standalone/test-unwind.c +++ b/test-suite/standalone/test-unwind.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004, 2005, 2008, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005, 2008, 2009, 2010, 2013 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -200,9 +200,20 @@ check_ports () #define FILENAME_TEMPLATE "/check-ports.XXXXXX" char *filename; const char *tmpdir = getenv ("TMPDIR"); +#ifdef __MINGW32__ + extern int mkstemp (char *); + /* On Windows neither $TMPDIR nor /tmp can be relied on. */ + if (tmpdir == NULL) + tmpdir = getenv ("TEMP"); + if (tmpdir == NULL) + tmpdir = getenv ("TMP"); + if (tmpdir == NULL) + tmpdir = "/"; +#else if (tmpdir == NULL) tmpdir = "/tmp"; +#endif filename = alloca (strlen (tmpdir) + sizeof (FILENAME_TEMPLATE) + 1); strcpy (filename, tmpdir);