2011/3/14 Jakub Jelinek <ja...@redhat.com>: > On Mon, Mar 14, 2011 at 12:18:16PM +0200, Janne Blomqvist wrote: >> On Sat, Mar 12, 2011 at 17:21, FX <fxcoud...@gmail.com> wrote: >> A static variable which is modified introduces a race condition. > > That is true. > >> Secondly, you reset the count to 0 at the start of every loop which >> makes the static thing superfluous? > > If M$ mktemp when already 26 files exist with the same prefix at least > properly fails, then it would be better to just retry with a changed prefix > if it fails.
Yes, altering prefix here would be in my opinion the saner way. Additional there shouldn't be a need to add locking, as a file itself is created if not already present, which represents a file-locking already. Regards, Kai