summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-05-24 17:18:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-05-24 17:18:53 +0000
commitfeddcd1bffb463f4445a2afaa0e49e3cc5d2ee70 (patch)
tree981c726be0d42a9e3c3d5578a7e2d3556154f405 /sys/kern
parentd534a3278df9e098bba0d7a8be6d4f598bb97f7f (diff)
correct return value of poll(); noted by d@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/sys_generic.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index b590c6ce82f..6e6f19d4be1 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_generic.c,v 1.18 1999/03/22 02:22:15 deraadt Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.19 1999/05/24 17:18:52 deraadt Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@@ -767,7 +767,7 @@ pollscan(p, pl, nfd, retval)
register struct filedesc *fdp = p->p_fd;
register int msk, i;
struct file *fp;
- int n = 0;
+ int x, n = 0;
static int flag[3] = { FREAD, FWRITE, 0 };
static int pflag[3] = { POLLIN|POLLRDNORM, POLLOUT, POLLERR };
@@ -783,15 +783,17 @@ pollscan(p, pl, nfd, retval)
}
continue;
}
- for (msk = 0; msk < 3; msk++) {
+ for (x = msk = 0; msk < 3; msk++) {
if (pl[i].events & pflag[msk]) {
if ((*fp->f_ops->fo_select)(fp, flag[msk], p)) {
pl[i].revents |= pflag[msk] &
pl[i].events;
- n++;
+ x++;
}
}
}
+ if (x)
+ n++;
}
*retval = n;
}