summaryrefslogtreecommitdiff
path: root/regress/sys/kern/kqueue
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-07-06 05:32:05 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-07-06 05:32:05 +0000
commit04c2eb54a519692ed461b53c475f60e112f62e77 (patch)
tree30fb6c1a0e443ba3f51218cbf158d56d11bb4ff7 /regress/sys/kern/kqueue
parent44c8e99c254f78dcad40ad87060fc7eabd34c640 (diff)
Switch to a device that isn't deprecated and return more info on
read failure
Diffstat (limited to 'regress/sys/kern/kqueue')
-rw-r--r--regress/sys/kern/kqueue/kqueue-random.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/regress/sys/kern/kqueue/kqueue-random.c b/regress/sys/kern/kqueue/kqueue-random.c
index 6a705c7733e..55ac3865c01 100644
--- a/regress/sys/kern/kqueue/kqueue-random.c
+++ b/regress/sys/kern/kqueue/kqueue-random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kqueue-random.c,v 1.5 2011/01/07 06:17:33 deraadt Exp $ */
+/* $OpenBSD: kqueue-random.c,v 1.6 2011/07/06 05:32:04 guenther Exp $ */
/* Written by Michael Shalayeff, 2002, Public Domain */
#include <stdlib.h>
@@ -23,8 +23,8 @@ do_random(void)
struct kevent ev;
u_int32_t buf[BUFSIZ];
- if ((fd = open("/dev/srandom", O_RDONLY)) < 0) {
- warn("open: /dev/srandom");
+ if ((fd = open("/dev/arandom", O_RDONLY)) < 0) {
+ warn("open: /dev/arandom");
return (1);
}
if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
@@ -59,6 +59,7 @@ do_random(void)
n = MIN((ev.data + 7) / 8, sizeof(buf));
if (read(fd, buf, n) < 1)
+ warnx("read %d", n);
return (1);
close(kq);