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>
This commit is contained in:
Tom Gundersen
2011-11-01 14:45:52 +01:00
committed by Lennart Poettering
parent bb53abeb8c
commit 7c2ec00930
+5 -1
View File
@@ -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);
}