[PATCH 2/3] stdlib: fix arc4random return type to u_int32_t

Peter Mazinger ps.m at gmx.net
Fri Mar 18 17:48:37 UTC 2011


Hi Timo,

committed a modified variant of it to future branch, changing all occurences of uint32_t to u_int32_t and uint8_t to u_int8_t.

Thanks, Peter

-------- Original-Nachricht --------
> Datum: Fri, 18 Mar 2011 15:36:58 +0200
> Von: "Timo Teräs" <timo.teras at iki.fi>
> An: uclibc at uclibc.org
> Betreff: [PATCH 2/3] stdlib: fix arc4random return type to u_int32_t

> It's documented to be u_int32_t and not uint32_t:
>  http://www.manpagez.com/man/3/arc4random/
> 
> This also fixes a major bug that stdlib.h includes stdint.h. Things
> might go very wrong because stdint.h has conditional defines and
> if stdlib.h is included before #define's for stdint.h we end up
> missing things and breaking builds (e.g. openjdk).
> 
> Signed-off-by: Timo Teräs <timo.teras at iki.fi>
> ---
>  include/stdlib.h         |    4 ++--
>  libc/stdlib/arc4random.c |    3 ++-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/include/stdlib.h b/include/stdlib.h
> index e9a8b84..7b35840 100644
> --- a/include/stdlib.h
> +++ b/include/stdlib.h
> @@ -902,8 +902,8 @@ extern int getloadavg (double __loadavg[], int
> __nelem)
>  #endif
>  
>  #ifdef __UCLIBC_HAS_ARC4RANDOM__
> -#include <stdint.h>
> -extern uint32_t arc4random(void);
> +# include <sys/types.h>
> +extern u_int32_t arc4random(void);
>  extern void arc4random_stir(void);
>  extern void arc4random_addrandom(unsigned char *, int);
>  #endif
> diff --git a/libc/stdlib/arc4random.c b/libc/stdlib/arc4random.c
> index c7aed66..7b9b12d 100644
> --- a/libc/stdlib/arc4random.c
> +++ b/libc/stdlib/arc4random.c
> @@ -30,6 +30,7 @@
>  #include <fcntl.h>
>  #include <stdlib.h>
>  #include <unistd.h>
> +#include <stdint.h>
>  #include <sys/types.h>
>  #include <sys/param.h>
>  #include <sys/time.h>
> @@ -175,7 +176,7 @@ arc4random_addrandom(u_char *dat, int datlen)
>  	arc4_addrandom(&rs, dat, datlen);
>  }
>  
> -uint32_t
> +u_int32_t
>  arc4random(void)
>  {
>  	if (!rs_initialized)
> -- 
> 1.7.1
> 
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc

-- 
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit 
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl


More information about the uClibc mailing list