.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=868
This commit is contained in:
parent
b428210733
commit
bee91c4ff6
@ -9,7 +9,7 @@ Related to bnc#892096
|
||||
1 file changed, 61 insertions(+), 10 deletions(-)
|
||||
|
||||
--- systemd-219/src/random-seed/random-seed.c
|
||||
+++ systemd-219/src/random-seed/random-seed.c 2015-04-21 09:26:07.589518787 +0000
|
||||
+++ systemd-219/src/random-seed/random-seed.c 2015-04-21 09:39:03.057518051 +0000
|
||||
@@ -22,7 +22,9 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
@ -86,14 +86,14 @@ Related to bnc#892096
|
||||
- r = loop_write(random_fd, buf, (size_t) k, false);
|
||||
- if (r < 0)
|
||||
- log_error_errno(r, "Failed to write seed to /dev/urandom: %m");
|
||||
+ if (entropy->entropy_count && (size_t) k == entropy->buf_size) {
|
||||
+ if (entropy->entropy_count && ((size_t)k) == entropy->buf_size) {
|
||||
+ r = ioctl(random_fd, RNDADDENTROPY, entropy);
|
||||
+ if (r < 0) {
|
||||
+ log_error_errno(errno, "Failed to write seed to /dev/urandom: %m");
|
||||
+ r = -errno;
|
||||
+ }
|
||||
+ } else {
|
||||
+ r = loop_write(random_fd, buf, (size_t) k, false);
|
||||
+ r = loop_write(random_fd, entropy->buf, (size_t) k, false);
|
||||
+ if (r < 0)
|
||||
+ log_error_errno(r, "Failed to write seed to /dev/urandom: %m");
|
||||
+ }
|
||||
@ -104,7 +104,7 @@ Related to bnc#892096
|
||||
+ /* Read available entropy count, if possible */
|
||||
+ f = fopen("/proc/sys/kernel/random/entropy_avail", "re");
|
||||
+ if (f) {
|
||||
+ if (fscanf(f, "%zu", &entropy->entropy_count) < 0)
|
||||
+ if (fscanf(f, "%d", &entropy->entropy_count) < 0)
|
||||
+ entropy->entropy_count = 0;
|
||||
+ fclose(f);
|
||||
+ }
|
||||
|
Loading…
Reference in New Issue
Block a user