Hi, Find by Yang Xichun (xichuan.yang at tieto.com). But, I think, we should remove meaningless variable and ambiguous comment. ==== patch ===== Subject: [PATCH] core: Remove meaningless variable and ambiguous comment Signed-off-by: Zhang Wanming <wanming.zhang at tieto.com> --- src/pulsecore/random.c | 18 ++++-------------- 1 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/pulsecore/random.c b/src/pulsecore/random.c index a87d24e..b5e9257 100644 --- a/src/pulsecore/random.c +++ b/src/pulsecore/random.c @@ -37,8 +37,6 @@ #include "random.h" -static pa_bool_t has_whined = TRUE; - static const char * const devices[] = { "/dev/urandom", "/dev/random", NULL }; static int random_proper(void *ret_data, size_t length) { @@ -48,7 +46,7 @@ static int random_proper(void *ret_data, size_t length) { return -1; -#else /* OS_IS_WIN32 */ +#else int fd, ret = -1; ssize_t r = 0; @@ -78,19 +76,14 @@ static int random_proper(void *ret_data, size_t length) { } return ret; -#endif /* OS_IS_WIN32 */ +#endif } void pa_random_seed(void) { unsigned int seed; if (random_proper(&seed, sizeof(unsigned int)) < 0) { - - if (!has_whined) { - pa_log_warn("Failed to get proper entropy. Falling back to seeding with current time."); - has_whined = TRUE; - } - + pa_log_warn("Failed to get proper entropy. Falling back to seeding with current time."); seed = (unsigned int) time(NULL); } @@ -106,11 +99,8 @@ void pa_random(void *ret_data, size_t length) { if (random_proper(ret_data, length) >= 0) return; - - if (!has_whined) { + else pa_log_warn("Failed to get proper entropy. Falling back to unsecure pseudo RNG."); - has_whined = TRUE; - } for (p = ret_data, l = length; l > 0; p++, l--) *p = (uint8_t) rand(); -- 1.7.1 On 12/16/2010 11:31 AM, yang xichuan wrote: > Hi all, > > In the file src/pulsecore/random.c > > I found that the log information "Failed to get proper entropy. > Falling back to seeding with current time." would never be printed. > > So I changed its value. > > Here's the patch: > > Signed-off-by: xichuan.yang <xichuan.yang at tieto.com> > --- > src/pulsecore/random.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/src/pulsecore/random.c b/src/pulsecore/random.c > index a87d24e..3d159bf 100644 > --- a/src/pulsecore/random.c > +++ b/src/pulsecore/random.c > @@ -37,7 +37,7 @@ > > #include "random.h" > > -static pa_bool_t has_whined = TRUE; > +static pa_bool_t has_whined = FALSE; > > static const char * const devices[] = { "/dev/urandom", > "/dev/random", NULL }; > > -- > 1.7.1 > > > > Best wishes, > Xichuan Yang > xichuan.yang<xichuan.yang at tieto.com> > > -- Thanks& best regards, Wanming Zhang --- Software Developer Tieto Device R&D Chengdu, China -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20101216/53cfc5f5/attachment.htm> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-core-Remove-meaningless-variable-and-ambiguous-comme.patch Type: text/x-patch Size: 1916 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20101216/53cfc5f5/attachment.bin>