Directory C:\Windows does not have to be accessible or does not have to
exist at all. For example when system is installed on D: letter or when old
pre-XP systems were installed in C:\WinNT directory.
Try to fallback to C:\ but in all cases ignore errors.
The whole test should work from any working directory.
---
mingw-w64-crt/testcases/t_tmpfile.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mingw-w64-crt/testcases/t_tmpfile.c
b/mingw-w64-crt/testcases/t_tmpfile.c
index c75e99c1f8e5..58515d432347 100644
--- a/mingw-w64-crt/testcases/t_tmpfile.c
+++ b/mingw-w64-crt/testcases/t_tmpfile.c
@@ -5,8 +5,9 @@
int main() {
FILE *file;
- /* ensure that tmpfile() works also when cwd is in C:\Windows */
- assert(chdir("C:\\Windows\\") == 0);
+ /* ensure that tmpfile() works also when cwd is in C:\Windows or C:\ but
do not fail if caller has no access to C:\ */
+ if (chdir("C:\\Windows\\") != 0)
+ chdir("C:\\");
file = tmpfile();
assert(file);
--
2.20.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public