[systemd-devel] [PATCH] random-seed: convert poolsize from bits to bytes

Tom Gundersen teg at jklm.no
Sat Oct 22 09:47:08 PDT 2011


The problem was first noted in a bug report against Arch's initscripts.

Reported-by: Taylan Ulrich Bayırlı <taylanbayirli at gmail.com>
Reported-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
---
 src/random-seed.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/random-seed.c b/src/random-seed.c
index ee5cae3..ccdedec 100644
--- a/src/random-seed.c
+++ b/src/random-seed.c
@@ -53,6 +53,8 @@ int main(int argc, char *argv[]) {
         if ((f = fopen("/proc/sys/kernel/random/poolsize", "re"))) {
                 fscanf(f, "%zu", &buf_size);
                 fclose(f);
+                /* poolsize is in bits, but we want bytes */
+                buf_size >>= 3;
         }
 
         if (buf_size <= POOL_SIZE_MIN)
-- 
1.7.7



More information about the systemd-devel mailing list