diff options
author | Jim Meyering <meyering@redhat.com> | 2007-09-01 10:33:33 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2007-10-07 19:44:07 +0200 |
commit | 7eab7d027e624350cc9749dcbb963e2d6d6a9b46 (patch) | |
tree | cfd9638327c8b88d8feb0b15e3d69718c1051bbf /gl/modules/tempname | |
parent | 58a7ead41d056909784bfab9323c5f44f577d3d0 (diff) | |
download | coreutils-7eab7d027e624350cc9749dcbb963e2d6d6a9b46.tar.xz |
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>
Diffstat (limited to 'gl/modules/tempname')
-rw-r--r-- | gl/modules/tempname | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gl/modules/tempname b/gl/modules/tempname index af689de6f..3d8431796 100644 --- a/gl/modules/tempname +++ b/gl/modules/tempname @@ -1,5 +1,5 @@ Description: -gen_tempname() function: create a private temporary file or directory. +gen_tempname, gen_tempname_len: create a private temporary file or directory. Files: lib/tempname.c @@ -9,6 +9,8 @@ m4/tempname.m4 Depends-on: extensions gettimeofday +randint +stdbool stdint sys_stat sys_time |