summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorMasao Uebayashi <uebayasi@cvs.openbsd.org>2015-08-13 10:11:39 +0000
committerMasao Uebayashi <uebayasi@cvs.openbsd.org>2015-08-13 10:11:39 +0000
commitea3d725dd32a724baca7dbf8ca135951697c377c (patch)
treeaab8eac2e8d1d2e16ed71357eff55a9aa9f45de9 /regress
parent246747aa8ca644b82579f775e4471fd058db3fcb (diff)
Zero-clear test buffer. KNF while here.
Diffstat (limited to 'regress')
-rw-r--r--regress/sys/kern/kqueue/kqueue-pty.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/regress/sys/kern/kqueue/kqueue-pty.c b/regress/sys/kern/kqueue/kqueue-pty.c
index e6f1e5ad8b4..a19e886db38 100644
--- a/regress/sys/kern/kqueue/kqueue-pty.c
+++ b/regress/sys/kern/kqueue/kqueue-pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kqueue-pty.c,v 1.5 2003/07/31 21:48:08 deraadt Exp $ */
+/* $OpenBSD: kqueue-pty.c,v 1.6 2015/08/13 10:11:38 uebayasi Exp $ */
/* Written by Michael Shalayeff, 2003, Public Domain */
@@ -11,6 +11,7 @@
#include <termios.h>
#include <fcntl.h>
#include <err.h>
+#include <string.h>
static int
pty_check(int kq, struct kevent *ev, int n, int rm, int rs, int wm, int ws)
@@ -74,6 +75,8 @@ do_pty(void)
if (kevent(kq, ev, 4, NULL, 0, NULL) < 0)
err(1, "slave: kevent add");
+ memset(buf, 0, sizeof buf);
+
if (write(massa, " ", 1) != 1)
err(1, "massa: write");
@@ -85,7 +88,8 @@ do_pty(void)
if (pty_check(kq, ev, 4, -massa, -slave, massa, slave))
return (1);
- while (write(massa, buf, sizeof(buf)) > 0);
+ while (write(massa, buf, sizeof(buf)) > 0)
+ continue;
if (pty_check(kq, ev, 4, -massa, slave, -massa, slave))
return (1);
@@ -95,7 +99,8 @@ do_pty(void)
if (pty_check(kq, ev, 4, -massa, slave, massa, slave))
return (1);
- while (read(slave, buf, sizeof(buf)) > 0);
+ while (read(slave, buf, sizeof(buf)) > 0)
+ continue;
if (pty_check(kq, ev, 4, -massa, -slave, massa, slave))
return (1);