]> Savannah Git Hosting - gnulib.git/commit
tempname: generate better names for MinGW Emacs
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 16 Aug 2022 19:06:48 +0000 (12:06 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 16 Aug 2022 19:08:24 +0000 (12:08 -0700)
commit512e44adaebb3096ddd1bf564e679d06e0301616
tree73b459a1781b3dbda27b991b563b512b904a518c
parentdec7194206fc1ec7db0a94472d8ece58025040c6
tempname: generate better names for MinGW Emacs

On MinGW, GNU Emacs disables clock_gettime, which reliably breaks
some of gen_tempname’s optimistic callers.  Work around the
problem by making the generated names less predictable.  We don’t
need cryptographic randomness here, just enough unpredictability
to keep Emacs happy most of the time.
* lib/tempname.c (HAS_CLOCK_ENTROPY): New macro.
(random_bits): Use it.
(try_tempname_len): On systems lacking clock entropy, maintain
state so that gen_filename generates less-predictable names on
successive successful calls.
ChangeLog
lib/tempname.c