[systemd-commits] src/random-seed.c
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Nov 1 06:47:00 PDT 2011
src/random-seed.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 7c2ec00930ce1f4aabfbb405d84b67eb9d065ef0
Author: Tom Gundersen <teg at jklm.no>
Date: Sat Oct 22 18:47:08 2011 +0200
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 at gmail.com>
Reported-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
diff --git a/src/random-seed.c b/src/random-seed.c
index ee5cae3..0c63794 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);
}
More information about the systemd-commits
mailing list