From 7c2ec00930ce1f4aabfbb405d84b67eb9d065ef0 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sat, 22 Oct 2011 18:47:08 +0200 Subject: random-seed: convert poolsize from bits to bytes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The problem was first noted in a bug report against Arch's initscripts. Reported-by: Taylan Ulrich Bayırlı Reported-by: Gerardo Exequiel Pozzi --- src/random-seed.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/random-seed.c') diff --git a/src/random-seed.c b/src/random-seed.c index ee5cae315c..0c63794b66 100644 --- a/src/random-seed.c +++ b/src/random-seed.c @@ -51,7 +51,11 @@ int main(int argc, char *argv[]) { /* Read pool size, if possible */ if ((f = fopen("/proc/sys/kernel/random/poolsize", "re"))) { - fscanf(f, "%zu", &buf_size); + if (fscanf(f, "%zu", &buf_size) > 0) { + /* poolsize is in bits on 2.6, but we want bytes */ + buf_size /= 8; + } + fclose(f); } -- cgit v1.2.3-54-g00ecf