Re: [Mingw-w64-public] [PATCH v2] crt: Use rand_s in the mkstemp function

2024-03-06 Thread LIU Hao
在 2024-03-06 17:09, Martin Storsjö 写道: From: Mateusz Mikuła (...) The changes in this patch were proposed by Josh Stone on Rust's Zulip server and I was asked to forward it. Co-Authored-By: Josh Stone Signed-off-by: Mateusz Mikuła Signed-off-by: Martin Storsjö ---

Re: [Mingw-w64-public] [PATCH] Use rand_s in mkstemp function

2024-03-06 Thread Mateusz Mikuła
Dnia środa, 6 marzec 2024 10:09:30 (+01:00), Martin Storsjö napisał(a): > On Mon, 4 Mar 2024, Martin Storsjö wrote: > > > Looking closer at our mkstemp implementation, we have this loop: > > > >/* > >Like OpenBSD, mkstemp() will try at least 2 ** 31 combinations before > >

[Mingw-w64-public] [PATCH v2] crt: Use rand_s in the mkstemp function

2024-03-06 Thread Martin Storsjö
From: Mateusz Mikuła When using mkstemp, there is no guarantee nor expectation that the caller has called srand() with an unique seed. Therefore, in practice, many users of mkstemp run with the same seed (unseeded). Normally, the implementation of mkstemp does handle collisions just fine, by

Re: [Mingw-w64-public] [PATCH] Use rand_s in mkstemp function

2024-03-06 Thread Martin Storsjö
On Mon, 4 Mar 2024, Martin Storsjö wrote: Looking closer at our mkstemp implementation, we have this loop: /* Like OpenBSD, mkstemp() will try at least 2 ** 31 combinations before giving up. */ for (i = 0; i >= 0; i++) { for(j = index; j < len; j++) {