You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Mladen Turk <mt...@apache.org> on 2004/08/28 16:43:55 UTC

[PATCH] fix apr_random

Hi,

This patch fixes the testrandom on WIN32.
Found by try-error-fix, knowing that
the allocated data on WIN32 is garbage, and
on unixes it might be zeroed, and that could
be the only cause why the test is passing on
my FreeBDS, but fails on WIN32.

Anyhow, all the tests passing now on WIN32,
except those with EINVAL.

Index: apr_random.c
===================================================================
RCS file: /home/cvspublic/apr/random/unix/apr_random.c,v
retrieving revision 1.9
diff -u -r1.9 apr_random.c
--- apr_random.c	28 Feb 2004 18:31:41 -0000	1.9
+++ apr_random.c	28 Aug 2004 14:35:06 -0000
@@ -111,8 +111,8 @@
                      /2)*g->pool_hash->size*2;
      g->reseed_size = APR_RANDOM_DEFAULT_RESEED_SIZE;

-    g->H = apr_palloc(p,H_size(g));
-    g->H_waiting = apr_palloc(p,H_size(g));
+    g->H = apr_pcalloc(p,H_size(g));
+    g->H_waiting = apr_pcalloc(p,H_size(g));

      g->randomness = apr_palloc(p,B_size(g));
      g->random_bytes = 0;


Regards,
MT.

Re: [PATCH] fix apr_random

Posted by Joe Orton <jo...@redhat.com>.
On Sat, Aug 28, 2004 at 04:43:55PM +0200, Mladen Turk wrote:
> Hi,
> 
> This patch fixes the testrandom on WIN32.
> Found by try-error-fix, knowing that
> the allocated data on WIN32 is garbage, and
> on unixes it might be zeroed, and that could
> be the only cause why the test is passing on
> my FreeBDS, but fails on WIN32.

I checked this in, the tests were failing consistently on Unix when
using ElectricFence in non-zero-fill mode too. Thanks for tracking it
down.

joe