summaryrefslogtreecommitdiff
path: root/usr.bin/asn1_compile/getarg.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-06-25 21:20:13 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-06-25 21:20:13 +0000
commitc43fcaaef8b1a8b4e1860eb5329e32ba4d9d0ad6 (patch)
tree7622b57adc4062b4ce1d784947f0a3911bc8d5e7 /usr.bin/asn1_compile/getarg.c
parentab174484018e75ef00e99c3f73be23ce9db3cdd4 (diff)
defn HAVE_ARC4RANDOM and use it
Diffstat (limited to 'usr.bin/asn1_compile/getarg.c')
-rw-r--r--usr.bin/asn1_compile/getarg.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/asn1_compile/getarg.c b/usr.bin/asn1_compile/getarg.c
index 65e9a604d12..86e9c447306 100644
--- a/usr.bin/asn1_compile/getarg.c
+++ b/usr.bin/asn1_compile/getarg.c
@@ -417,7 +417,9 @@ arg_match_long(struct getargs *args, size_t num_args,
*flag = !negate;
return 0;
} else if (*goptarg && strcmp(goptarg + 1, "maybe") == 0) {
-#ifdef HAVE_RANDOM
+#ifdef HAVE_ARC4RANDOM
+ *flag = arc4random() & 1;
+#elif HAVE_RANDOM
*flag = random() & 1;
#else
*flag = rand() & 1;
@@ -536,6 +538,8 @@ getarg(struct getargs *args, size_t num_args,
int i;
int ret = 0;
+#ifndef HAVE_ARC4RANDOM
+
#if defined(HAVE_SRANDOMDEV)
srandomdev();
#elif defined(HAVE_RANDOM)
@@ -543,6 +547,9 @@ getarg(struct getargs *args, size_t num_args,
#else
srand (time(NULL));
#endif
+
+#endif /* HAVE_ARC4RANDOM */
+
(*goptind)++;
for(i = *goptind; i < argc; i++) {
if(argv[i][0] != '-')