From: Lennart Poettering Date: Sun, 10 May 2020 09:13:49 +0000 (+0200) Subject: random-util: actually encode our expectations on RAND_MAX X-Git-Tag: v246-rc1~393^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=57ee010ff2beb93f2353668a8e347981a8d46ff2;p=thirdparty%2Fsystemd.git random-util: actually encode our expectations on RAND_MAX --- diff --git a/src/basic/random-util.c b/src/basic/random-util.c index eae488ae5d9..363a1f71513 100644 --- a/src/basic/random-util.c +++ b/src/basic/random-util.c @@ -325,9 +325,11 @@ void initialize_srand(void) { /* INT_MAX gives us only 31 bits, so use 24 out of that. */ #if RAND_MAX >= INT_MAX +assert_cc(RAND_MAX >= 16777215); # define RAND_STEP 3 #else -/* SHORT_INT_MAX or lower gives at most 15 bits, we just just 8 out of that. */ +/* SHORT_INT_MAX or lower gives at most 15 bits, we just use 8 out of that. */ +assert_cc(RAND_MAX >= 255); # define RAND_STEP 1 #endif