summaryrefslogtreecommitdiff
path: root/modules/tempname
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-05-31 20:15:25 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-05-31 22:16:58 -0700
commit78f55d5374d6ff9b8460c48a42e924bf69775cd7 (patch)
tree2a649608f2898ee98a8552e5d696ca8dcdf7148a /modules/tempname
parentd4429157c13b49d1749f5ea18fb30e24ffa646aa (diff)
downloadgnulib-78f55d5374d6ff9b8460c48a42e924bf69775cd7.tar.gz
tempname: merge from glibc and coreutils
Also, merge in Gnulib’s more-recent methods of making it easier to share between Gnulib and glibc, and fix a few randomness glitches. * lib/tempname.c: Include libc-config.h, not config.h, if !_LIBC. (__set_errno): Remove; libc-config.h does that for us. Do not include <sys/time.h>. (__secure_getenv) [_LIBC]: New macro. (__try_tempname, __getpid, __gettimeofday) [!_LIBC]: Remove macros. (RANDOM_BITS): Rewrite. (RANDOM_VALUE_MAX, BASE_62_DIGITS, BASE_62_POWER): New macros. (random_value): New typedef. (try_file, try_dir, try_nocreate): Move up. (gen_tempname_len, try_tempname_len): New functions. (gen_tempname_len): Use a constant array rather than a switch. (try_tempname_len): Don’t assume string length fits in int. Generalize use of RANDOM_BITS. If _LIBC, don’t assume RANDOM_BITS has enough entropy (it’s a bit short). (__gen_tempname): Rewrite in terms of gen_tempname_len. (__try_tempname): Rewrite in terms of try_tempname_len. * lib/tempname.h (gen_tempname_len, try_tempname_len): New decls. * modules/tempname (Depends-on): Remove gettimeofday, sys_time. Add getentropy, libc-config.
Diffstat (limited to 'modules/tempname')
-rw-r--r--modules/tempname4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/tempname b/modules/tempname
index fa91ed3979..6d6a034ebc 100644
--- a/modules/tempname
+++ b/modules/tempname
@@ -10,12 +10,12 @@ m4/tempname.m4
Depends-on:
extensions
fcntl-h
-gettimeofday
+getentropy
+libc-config
lstat
mkdir
stdint
sys_stat
-sys_time
configure.ac:
gl_FUNC_GEN_TEMPNAME