openbsd-ports/security/pwgen/patches/patch-randnum_c
sthen 3dbd1f5077 update pwgen to 2.06: bug fixes and adds -y option to include symbols
in the generated password.

from Pierre-Emmanuel André on ports@, ok robert
2007-12-04 10:28:29 +00:00

25 lines
512 B
Plaintext

$OpenBSD: patch-randnum_c,v 1.2 2007/12/04 10:28:29 sthen Exp $
--- randnum.c.orig Thu Jul 5 01:42:19 2007
+++ randnum.c Mon Dec 3 09:15:48 2007
@@ -17,6 +17,15 @@
#include "pwgen.h"
+#ifdef HAVE_ARC4RANDOM
+
+int pw_random_number(int max_num)
+{
+ return (arc4random() % max_num);
+}
+
+#else
+
#ifdef HAVE_DRAND48
extern double drand48(void);
#endif
@@ -93,3 +102,4 @@ int pw_random_number(max_num)
return ((int) (random() / ((float) RAND_MAX) * max_num));
#endif
}
+#endif /* HAVE_ARC4RANDOM */