mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
urngd: fix busy loop in case of ioctl cause high cpu usage
This commit is contained in:
parent
e616c4b3f8
commit
e3b1fa5ef0
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=urngd
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/urngd.git
|
||||
|
@ -0,0 +1,19 @@
|
||||
diff --git a/urngd.c b/urngd.c
|
||||
index 35ccdec..410d300 100644
|
||||
--- a/urngd.c
|
||||
+++ b/urngd.c
|
||||
@@ -129,9 +129,14 @@ static size_t gather_entropy(struct urngd *u)
|
||||
static void low_entropy_cb(struct uloop_fd *ufd, unsigned int events)
|
||||
{
|
||||
struct urngd *u = container_of(ufd, struct urngd, rnd_fd);
|
||||
+ size_t res;
|
||||
|
||||
DEBUG(2, DEV_RANDOM " signals low entropy\n");
|
||||
- gather_entropy(u);
|
||||
+ res = gather_entropy(u);
|
||||
+ if (!res) {
|
||||
+ DEBUG(2, "gather_entropy failed, delaying further attempts\n");
|
||||
+ sleep(60);
|
||||
+ }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user