On Friday 19 December 2025 21:49:11 LIU Hao wrote:
> 在 2025-12-19 21:45, Pali Rohár 写道:
> > I have two ideas now:
> > 
> > 1. Implement mkdtemp for mingw-w64 as copy of mingw-w64 mkstemp and
> > replacing "creating file" by "creating directory". This does not fully
> > address the test issue as the POSIX mkdtemp is taking template string,
> > which would be needed in the test to generate from GetTempPathA().
> > 
> > OR
> > 
> > 2. Provide test-only function named e.g. tmpdir() available only in
> > mingw-w64-crt/testcases/ and its implementation would be same as
> > existing C89 function in mingw-w64-crt/stdio/tmpfile.c just it will
> > return file descriptor of newly created directory which test can use it.
> > 
> 
> You can call `CoCreateGuid()` to create a UUID and use it as the directory 
> name.

I decided to implement POSIX mkdtemp() function, it can also help other
applications. I sent implementation to the list in separate email. Plus
I fixed small fallback path issue in mkstemp().

For example Linux manpage for tempnam() says "Never use this function."

So mkdtemp is the only "portable" replacement for this issue.


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to