DragonFlyBSD Kernel Audit
DF-1670 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/virtual/vkernel/net/if_vke.c
+++ b/sys/dev/virtual/vkernel/net/if_vke.c
@@ -628,8 +628,7 @@
 	struct vke_softc *sc = cotd->arg;
 	struct ifnet *ifp = &sc->arpcom.ac_if;
 	fifo_t fifo = sc->sc_rxfifo;
-	fd_set fdset;
-	struct timeval tv;
+	struct pollfd pfd;
 	int count;
 	int n;
 	int r;
@@ -637,10 +636,8 @@
 	/* Select timeout cannot be infinite since we need to check for
 	 * the exit flag sc->cotd_rx_exit.
 	 */
-	tv.tv_sec = 0;
-	tv.tv_usec = 500000;
-
-	FD_ZERO(&fdset);
+	pfd.fd = sc->sc_fd;
+	pfd.events = POLLIN;
 	count = 0;
 
 	while (sc->cotd_rx_exit == VKE_COTD_RUN) {
@@ -683,8 +680,7 @@
 				cothread_intr(cotd);
 				count = 0;
 			}
-			FD_SET(sc->sc_fd, &fdset);
-			r = select(sc->sc_fd + 1, &fdset, NULL, NULL, &tv);
+			r = poll(&pfd, 1, 500);
 			if (r == -1) {
 				fprintf(stderr,
 					VKE_DEVNAME "%d: select failed for "