summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2011-10-22 18:47:08 +0200
committerLennart Poettering <lennart@poettering.net>2011-11-01 14:45:52 +0100
commit7c2ec00930ce1f4aabfbb405d84b67eb9d065ef0 (patch)
tree8cd436b862e699ba633c6da93169a5357b50d12a
parentbb53abeb8c3407ea250be69bc43510b03c0df3da (diff)
random-seed: convert poolsize from bits to bytes
The problem was first noted in a bug report against Arch's initscripts. Reported-by: Taylan Ulrich Bayırlı <taylanbayirli@gmail.com> Reported-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
-rw-r--r--src/random-seed.c6
1 files changed, 5 insertions, 1 deletions
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);
}