mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Working implementation of mkstemp on Windows.
This commit is contained in:
parent
b456fba69f
commit
b10144e5b4
@ -226,16 +226,15 @@ gettimeofday(struct timeval* p, void* tz)
|
|||||||
int
|
int
|
||||||
mkstemp(char *template)
|
mkstemp(char *template)
|
||||||
{
|
{
|
||||||
char tempname[MAX_PATH];
|
|
||||||
char pathname[MAX_PATH];
|
char pathname[MAX_PATH];
|
||||||
|
|
||||||
/* Get the directory for temp files */
|
/* Get the directory for temp files */
|
||||||
GetTempPath(MAX_PATH, pathname);
|
GetTempPath(MAX_PATH, pathname);
|
||||||
|
|
||||||
/* Create a temporary file. */
|
/* Create a temporary file. */
|
||||||
GetTempFileName(pathname, template, 0, tempname);
|
GetTempFileName(pathname, "ABC", 0, template);
|
||||||
|
|
||||||
return open(tempname, O_CREAT | O_WRONLY | O_EXCL | O_BINARY);
|
return open(template, O_WRONLY | O_BINARY | O_EXCL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -274,7 +274,7 @@ secure_close(struct secure_save_info *ssi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ssi->secure_save && ssi->file_name && ssi->tmp_file_name) {
|
if (ssi->secure_save && ssi->file_name && ssi->tmp_file_name) {
|
||||||
#ifdef CONFIG_OS_OS2
|
#if defined(CONFIG_OS_OS2) || defined(CONFIG_OS_WIN32)
|
||||||
/* OS/2 needs this, however it breaks atomicity on
|
/* OS/2 needs this, however it breaks atomicity on
|
||||||
* UN*X. */
|
* UN*X. */
|
||||||
unlink(ssi->file_name);
|
unlink(ssi->file_name);
|
||||||
|
Loading…
Reference in New Issue
Block a user