patch-src_port_h 851 B

1234567891011121314151617181920212223242526
  1. $OpenBSD: patch-src_port_h,v 1.1 2013/08/15 14:54:07 naddy Exp $
  2. --- src/port.h.orig Sun Aug 11 22:56:24 2013
  3. +++ src/port.h Sun Aug 11 23:00:53 2013
  4. @@ -246,7 +246,11 @@ extern char *sys_errlist[];
  5. * not agree with RAND_MAX. We must not link with -lucb.
  6. */
  7. -#ifdef HAVE_srandom
  8. +#if defined(HAVE_arc4random) && defined(HAVE_arc4random_uniform)
  9. +# define RAND() arc4random()
  10. +# define SRAND(seed) /* empty */
  11. +# define RRAND(lo,hi) (arc4random_uniform((hi)-(lo)) + (lo))
  12. +#elif defined(HAVE_srandom)
  13. # include <math.h>
  14. # define RAND() (int)random()
  15. # define SRAND(seed) srandom(seed)
  16. @@ -262,7 +266,7 @@ extern char *sys_errlist[];
  17. # define RRAND(lo,hi) (RAND() % ((hi)-(lo)+1) + (lo))
  18. # endif
  19. # else
  20. - error "Don't have srand() or srandom()."
  21. +# error "Don't have srand() or srandom()."
  22. # endif
  23. #endif