﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
819	file-mkstemp on windows is broken	Jim Ursetto		"posixwin.scm file-mkstemp utilizes C_mkstemp which is defined as 

#define C_mkstemp(t)        C_fix(mktemp(C_c_string(t)))

However mktemp returns a char* pointer to the updated template, not an FD as file-mkstemp expects.  It seems that mkstemp() was just changed to mktemp() on Windows without checking if it does the same thing.

In my tests on mingw, the template requires exactly 6 Xs.  Otherwise it will return NULL (which is translated to FD 0).  On success it returns a pointer which is translated to a nonsense FD.

{{{
#;1> (file-mkstemp ""test.XXX"")
0
""test.960""
; 2 values
#;1> (file-mkstemp ""test.XXXXXX"")
2253780
""test.a01960""
; 2 values
}}}

I think file-mkstemp should throw unimplemented error on Windows instead.  Alternatively it could probably be implemented by using mktemp and file-open with (+ open/creat open/excl) in a loop, but you have to get the permissions right and I'm sure there are even more hairy details."	defect	closed	minor	4.10.0	core libraries	4.7.x	fixed			
