diff --git a/lib/tempname.c b/lib/tempname.c index e6520191d7..e3d09d963d 100644 --- a/lib/tempname.c +++ b/lib/tempname.c @@ -71,7 +71,8 @@ /* Use getrandom if it works, falling back on a 64-bit linear congruential generator that starts with Var's value - mixed in with a clock's low-order bits if available. */ + mixed in with a clock's low-order bits (or with some other + pseudorandom number) if available. */ typedef uint_fast64_t random_value; #define RANDOM_VALUE_MAX UINT_FAST64_MAX #define BASE_62_DIGITS 10 /* 62**10 < UINT_FAST64_MAX */ @@ -89,6 +90,9 @@ random_bits (random_value var, bool use_getrandom) struct __timespec64 tv; __clock_gettime64 (CLOCK_MONOTONIC, &tv); var ^= tv.tv_nsec; +#else + /* Fall back on pseudorandom number . */ + var ^= rand (); #endif return 2862933555777941757 * var + 3037000493; }