summaryrefslogtreecommitdiff
path: root/src/random-seed
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2022-10-25 13:54:10 +0200
committerFranck Bui <fbui@suse.com>2022-10-25 13:56:37 +0200
commit46e0b5dca7fa5368bccbf30a7d2569d93d994a44 (patch)
tree69a782bf53ad4e005864e14c314d58bc2e45af6b /src/random-seed
parentea37e1edf9bdaa5a90050d69454a132dc5d60360 (diff)
downloadsystemd-46e0b5dca7fa5368bccbf30a7d2569d93d994a44.tar.gz
random-seed: clarify one comment
Diffstat (limited to 'src/random-seed')
-rw-r--r--src/random-seed/random-seed.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
index 7782509572..22ddf659ae 100644
--- a/src/random-seed/random-seed.c
+++ b/src/random-seed/random-seed.c
@@ -249,12 +249,13 @@ static int save_seed_file(
if (!buf)
return log_oom();
- /* Let's make this whole job asynchronous, i.e. let's make ourselves a barrier for proper
- * initialization of the random pool. */
k = getrandom(buf, seed_size, GRND_NONBLOCK);
if (k < 0 && errno == EAGAIN && synchronous) {
+ /* If we're asked to make ourselves a barrier for proper initialization of the random pool
+ * make this whole job synchronous by asking getrandom() to wait until the requested number
+ * of random bytes is available. */
log_notice("Kernel entropy pool is not initialized yet, waiting until it is.");
- k = getrandom(buf, seed_size, 0); /* retry synchronously */
+ k = getrandom(buf, seed_size, 0);
}
if (k < 0)
log_debug_errno(errno, "Failed to read random data with getrandom(), falling back to /dev/urandom: %m");