]> git.ipfire.org Git - thirdparty/coreutils.git/commit
Make tempname more random, via the randint module.
authorJim Meyering <meyering@redhat.com>
Sat, 1 Sep 2007 08:33:33 +0000 (10:33 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 7 Oct 2007 17:44:07 +0000 (19:44 +0200)
commit7eab7d027e624350cc9749dcbb963e2d6d6a9b46
treecfd9638327c8b88d8feb0b15e3d69718c1051bbf
parent58a7ead41d056909784bfab9323c5f44f577d3d0
Make tempname more random, via the randint module.

* gl/modules/tempname (Depends-on): Add randint and stdbool.
* gl/lib/tempname.c: Include randint.h and stdbool.h.
(uint64_t): Remove definition.  Not needed.
[_LIBC] (RANDOM_BITS): Remove this block, now that we have proper random bits.
(check_x_suffix): New function.
(gen_tempname_len): Rename from __gen_tempname.
Add a parameter, x_suffix_len, telling how many X's there must be at
the end of the template.
Use pseudo-random numbers all the way, rather than adding 7777
from one iteration to the next.
(__gen_tempname): New function, to call gen_tempname_len, requiring a
suffix length of 6.
* gl/lib/tempname.h: Add prototype for gen_tempname_len.

Signed-off-by: Jim Meyering <meyering@redhat.com>
ChangeLog
gl/lib/tempname.c
gl/lib/tempname.h
gl/modules/tempname