]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
random-seed: clarify one comment 25092/head
authorFranck Bui <fbui@suse.com>
Tue, 25 Oct 2022 11:54:10 +0000 (13:54 +0200)
committerFranck Bui <fbui@suse.com>
Tue, 25 Oct 2022 11:56:37 +0000 (13:56 +0200)
src/random-seed/random-seed.c

index 7782509572f34d95d591adaa9a9b12f47ba1a0f4..22ddf659ae71776b18cadc86306d1f7d3e52cff9 100644 (file)
@@ -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");