1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

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-10-22 18:47:08 +02:00 committed by Lennart Poettering
parent bb53abeb8c
commit 7c2ec00930

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);
}