diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-04-20 10:48:22 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-04-20 17:12:39 +0200 |
commit | b0dbffd86856d60e0c558505978ef56d087960f9 (patch) | |
tree | edfee402f5314f34cd2aecae8734e4458d65f917 | |
parent | loop-util: make loop_device_make() return fd in all code paths (diff) | |
download | systemd-b0dbffd86856d60e0c558505978ef56d087960f9.tar.xz systemd-b0dbffd86856d60e0c558505978ef56d087960f9.zip |
loop-util: port to random_u64_range()
Doesn't matter, but it's a bit easier to read I'd claim.
-rw-r--r-- | src/shared/loop-util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c index 9ec2f0c1ab..b8f7d0cc7b 100644 --- a/src/shared/loop-util.c +++ b/src/shared/loop-util.c @@ -252,7 +252,7 @@ static int loop_configure( /* Sleep some random time, but at least 10ms, at most 250ms. Increase the delay the more * failed attempts we see */ (void) usleep(UINT64_C(10) * USEC_PER_MSEC + - random_u64() % (UINT64_C(240) * USEC_PER_MSEC * n_attempts/64)); + random_u64_range(UINT64_C(240) * USEC_PER_MSEC * n_attempts/64)); } return 0; @@ -422,8 +422,8 @@ int loop_device_make( /* Wait some random time, to make collision less likely. Let's pick a random time in the * range 0ms…250ms, linearly scaled by the number of failed attempts. */ - (void) usleep(random_u64() % (UINT64_C(10) * USEC_PER_MSEC + - UINT64_C(240) * USEC_PER_MSEC * n_attempts/64)); + (void) usleep(random_u64_range(UINT64_C(10) * USEC_PER_MSEC + + UINT64_C(240) * USEC_PER_MSEC * n_attempts/64)); } if (fstat(loop_with_fd, &st) < 0) |