Signed-off-by: Mateusz Mikuła
---
mingw-w64-crt/misc/mkstemp.c | 12 +---
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/mingw-w64-crt/misc/mkstemp.c b/mingw-w64-crt/misc/mkstemp.c
index 3b6246540..7291efcc8 100644
--- a/mingw-w64-crt/misc/mkstemp.c
+++ b/mingw-w64-crt/misc/mkstemp.c
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
/*
The mkstemp() function generates a unique temporary filename from template,
@@ -25,8 +26,8 @@
*/
int __cdecl mkstemp (char *template_name)
{
-int i, j, fd, len, index;
-unsigned int r;
+int j, fd, len, index;
+unsigned int i, r;
/* These are the (62) characters used in temporary filenames. */
static const char letters[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
@@ -41,11 +42,8 @@ int __cdecl mkstemp (char *template_name)
/* User may supply more than six trailing Xs */
for (index = len - 6; index > 0 && template_name[index - 1] == 'X';
index--);
-/*
-Like OpenBSD, mkstemp() will try at least 2 ** 31 combinations before
-giving up.
- */
-for (i = 0; i >= 0; i++) {
+/* Like OpenBSD, mkstemp() will try 2 ** 31 combinations before giving up.
*/
+for (i = 0; i <= INT_MAX; i++) {
for(j = index; j < len; j++) {
if (rand_s())
r = rand();
--
2.44.0.windows.1
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public