<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
Find by Yang Xichun (<a class="moz-txt-link-abbreviated" href="mailto:xichuan.yang@tieto.com">xichuan.yang@tieto.com</a>).<br>
But, I think, we should remove meaningless variable and ambiguous
comment.<br>
<br>
==== patch =====<br>
<br>
Subject: [PATCH] core: Remove meaningless variable and ambiguous
comment<br>
<br>
Signed-off-by: Zhang Wanming <a class="moz-txt-link-rfc2396E" href="mailto:wanming.zhang@tieto.com"><wanming.zhang@tieto.com></a><br>
---<br>
src/pulsecore/random.c | 18 ++++--------------<br>
1 files changed, 4 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/pulsecore/random.c b/src/pulsecore/random.c<br>
index a87d24e..b5e9257 100644<br>
--- a/src/pulsecore/random.c<br>
+++ b/src/pulsecore/random.c<br>
@@ -37,8 +37,6 @@<br>
<br>
#include "random.h"<br>
<br>
-static pa_bool_t has_whined = TRUE;<br>
-<br>
static const char * const devices[] = { "/dev/urandom",
"/dev/random", NULL };<br>
<br>
static int random_proper(void *ret_data, size_t length) {<br>
@@ -48,7 +46,7 @@ static int random_proper(void *ret_data, size_t
length) {<br>
<br>
return -1; <br>
<br>
-#else /* OS_IS_WIN32 */<br>
+#else<br>
<br>
int fd, ret = -1; <br>
ssize_t r = 0;<br>
@@ -78,19 +76,14 @@ static int random_proper(void *ret_data, size_t
length) {<br>
} <br>
<br>
return ret;<br>
-#endif /* OS_IS_WIN32 */<br>
+#endif<br>
}<br>
<br>
void pa_random_seed(void) {<br>
unsigned int seed;<br>
<br>
if (random_proper(&seed, sizeof(unsigned int)) < 0) {<br>
-<br>
- if (!has_whined) {<br>
- pa_log_warn("Failed to get proper entropy. Falling back
to seeding with current time.");<br>
- has_whined = TRUE;<br>
- }<br>
-<br>
+ pa_log_warn("Failed to get proper entropy. Falling back to
seeding with current time.");<br>
seed = (unsigned int) time(NULL);<br>
} <br>
<br>
@@ -106,11 +99,8 @@ void pa_random(void *ret_data, size_t length) {<br>
if (random_proper(ret_data, length) >= 0)<br>
return;<br>
-<br>
- if (!has_whined) {<br>
+ else<br>
pa_log_warn("Failed to get proper entropy. Falling back to
unsecure pseudo RNG.");<br>
- has_whined = TRUE;<br>
- }<br>
<br>
for (p = ret_data, l = length; l > 0; p++, l--)<br>
*p = (uint8_t) rand();<br>
-- <br>
1.7.1<br>
<br>
<br>
On 12/16/2010 11:31 AM, yang xichuan wrote:
<blockquote cite="mid:4D098818.9020102@tieto.com" type="cite">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
Hi all,<br>
<br>
<span style="visibility: visible;" id="main"><span
style="visibility: visible;" id="search">In the file </span></span>src/pulsecore/random.c<br>
<br>
I found that the log information "Failed to get proper entropy.
Falling back to seeding with current time." would never be
printed.<br>
<br>
So I changed its value. <br>
<br>
Here's the patch:<br>
<br>
Signed-off-by: xichuan.yang <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:xichuan.yang@tieto.com"><xichuan.yang@tieto.com></a><br>
---<br>
src/pulsecore/random.c | 2 +-<br>
1 files changed, 1 insertions(+), 1 deletions(-)<br>
<br>
diff --git a/src/pulsecore/random.c b/src/pulsecore/random.c<br>
index a87d24e..3d159bf 100644<br>
--- a/src/pulsecore/random.c<br>
+++ b/src/pulsecore/random.c<br>
@@ -37,7 +37,7 @@<br>
<br>
#include "random.h"<br>
<br>
-static pa_bool_t has_whined = TRUE;<br>
+static pa_bool_t has_whined = FALSE;<br>
<br>
static const char * const devices[] = { "/dev/urandom",
"/dev/random", NULL };<br>
<br>
-- <br>
1.7.1<br>
<br>
<br>
<br>
Best wishes,<br>
Xichuan Yang<br>
<pre wrap="">xichuan.yang <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:xichuan.yang@tieto.com"><xichuan.yang@tieto.com></a>
</pre>
<br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Thanks & best regards,
Wanming Zhang
---
Software Developer
Tieto Device R&D Chengdu, China</pre>
</body>
</html>