]> Zhao Yanbai Git Server - minix.git/commitdiff
Clear NONBLOCK flag after probing ethernet device.
authorPhilip Homburg <philip@cs.vu.nl>
Fri, 14 Jul 2006 13:35:21 +0000 (13:35 +0000)
committerPhilip Homburg <philip@cs.vu.nl>
Fri, 14 Jul 2006 13:35:21 +0000 (13:35 +0000)
commands/dhcpd/devices.c

index 02944fb3502103fa2ce7466dffab68673113eea0..3d12a16489e8d0c583d8d84af54c10729b8281c6 100755 (executable)
@@ -173,12 +173,14 @@ int opendev(network_t *np, fdtype_t fdtype, int compete)
 
     switch (fdtype) {
     case FT_ETHERNET:
+       /* Set NONBLOCK to avoid waiting for a device driver to become ready */
        fcntl(np->fdp->fd, F_SETFL, fcntl(np->fdp->fd, F_GETFL) | O_NONBLOCK);
        if (ioctl(np->fdp->fd, NWIOGETHSTAT, &ethstat) < 0) {
            /* Not an Ethernet. */
            close(fdp->fd);
            return 0;
        }
+       fcntl(np->fdp->fd, F_SETFL, fcntl(np->fdp->fd, F_GETFL) & ~O_NONBLOCK);
        np->eth= ethstat.nwes_addr;
        ethopt.nweo_flags= NWEO_COPY | NWEO_EN_LOC | NWEO_EN_BROAD
                        | NWEO_REMANY | NWEO_TYPEANY | NWEO_RWDATALL;