diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2008-04-13 00:22:18 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2008-04-13 00:22:18 +0000 |
commit | f15cc9e98f102b443a7b1bc97ce7b524d3453c7e (patch) | |
tree | cd34ef18f375e585b2843c566e08b7a49da49084 /regress/sys/kern | |
parent | dd3e3e68352b843aef5b3347835e71e9f26a0d92 (diff) |
Use arc4random_buf() when requesting more than a single word of output
Use arc4random_uniform() when the desired random number upper bound
is not a power of two
ok deraadt@ millert@
Diffstat (limited to 'regress/sys/kern')
-rw-r--r-- | regress/sys/kern/signal-stress/signal-stress.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/regress/sys/kern/signal-stress/signal-stress.c b/regress/sys/kern/signal-stress/signal-stress.c index 9f40e0bb680..61aa23bcd66 100644 --- a/regress/sys/kern/signal-stress/signal-stress.c +++ b/regress/sys/kern/signal-stress/signal-stress.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signal-stress.c,v 1.2 2004/08/05 15:06:59 art Exp $ */ +/* $OpenBSD: signal-stress.c,v 1.3 2008/04/13 00:22:17 djm Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2004 Public Domain. */ @@ -140,14 +140,14 @@ main() * Now all children are ready for action. * Send the first signals and wait until they all exit. */ - kill(pids[arc4random() % nprocs], SIGUSR1); - kill(pids[arc4random() % nprocs], SIGUSR2); + kill(pids[arc4random_uniform(nprocs)], SIGUSR1); + kill(pids[arc4random_uniform(nprocs)], SIGUSR2); /* * The signal game is running, now insert noise in the process. */ for (i = 0; i < nprocs; i++) { - pid_t pid = pids[arc4random() % nprocs]; + pid_t pid = pids[arc4random_uniform(nprocs)]; kill(pid, SIGSTOP); wait_stopped(pid); kill(pid, SIGCONT); |