diff options
author | Ron Yorston <rmy@pobox.com> | 2014-01-07 22:39:35 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2014-01-07 22:39:35 +0000 |
commit | 7f0cb741c77f74a48ffd10a1e7d36ff2adf95f03 (patch) | |
tree | 11b7d44f8c42d7d39d641e56d6fdd5ef7aed94d6 /win32 | |
parent | 94150aba92d308e417aa552a1b3a957be264b423 (diff) | |
download | busybox-w32-7f0cb741c77f74a48ffd10a1e7d36ff2adf95f03.tar.gz busybox-w32-7f0cb741c77f74a48ffd10a1e7d36ff2adf95f03.tar.bz2 busybox-w32-7f0cb741c77f74a48ffd10a1e7d36ff2adf95f03.zip |
Implement POSIX-compliant mktemp for WIN32
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index b9f720e1a..70a8cb611 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -435,6 +435,20 @@ unsigned int sleep (unsigned int seconds) | |||
435 | return 0; | 435 | return 0; |
436 | } | 436 | } |
437 | 437 | ||
438 | /* | ||
439 | * Windows' mktemp returns NULL on error whereas POSIX always returns the | ||
440 | * template and signals an error by making it an empty string. | ||
441 | */ | ||
442 | #undef mktemp | ||
443 | char *mingw_mktemp(char *template) | ||
444 | { | ||
445 | if ( mktemp(template) == NULL ) { | ||
446 | template[0] = '\0'; | ||
447 | } | ||
448 | |||
449 | return template; | ||
450 | } | ||
451 | |||
438 | int mkstemp(char *template) | 452 | int mkstemp(char *template) |
439 | { | 453 | { |
440 | char *filename = mktemp(template); | 454 | char *filename = mktemp(template); |