X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Fdhcpclient_src%2Fmain.c;h=4d44a5d96b3d6f0a5302f85aa0bbe75abda7e279;hb=7ac33dd5e5baa147d47b9798878fea8b0586fe6c;hp=5b1d38021ad1c54f516203dd5cc0e2a1891c8d44;hpb=7ba570fe3cc5418f42decf5b72ac2295cce9e60f;p=tpg%2Facess2.git diff --git a/Usermode/Applications/dhcpclient_src/main.c b/Usermode/Applications/dhcpclient_src/main.c index 5b1d3802..4d44a5d9 100644 --- a/Usermode/Applications/dhcpclient_src/main.c +++ b/Usermode/Applications/dhcpclient_src/main.c @@ -90,7 +90,6 @@ int main(int argc, char *argv[]) { tInterface *ifaces = NULL, *i; - // TODO: Scan /Devices and search for network adapters if( argc > 2 ) { fprintf(stderr, "Usage: %s \n", argv[0]); return -1; @@ -131,9 +130,9 @@ int main(int argc, char *argv[]) if(maxfd < i->SocketFD) maxfd = i->SocketFD; } - if( select(maxfd+1, &fds, NULL, NULL, &timeout) < 0 ) + if( _SysSelect(maxfd+1, &fds, NULL, NULL, &timeout, 0) < 0 ) { - // TODO: Check error result + perror("_SysSelect returned error"); return -1; } @@ -152,7 +151,7 @@ int main(int argc, char *argv[]) { if( Handle_Timeout(i) ) { - fprintf(stderr, "%s timed out\n", i->Adapter); + fprintf(stderr, "DHCP on %s timed out\n", i->Adapter); goto _remove; } } @@ -207,11 +206,14 @@ int Start_Interface(tInterface *Iface) sprintf(path, "/Devices/ip/adapters/%s", Iface->Adapter); fd = _SysOpen(path, 0); if(fd == -1) { + perror("Opening adapter"); _SysDebug("Unable to open adapter %s", path); return -1; } - _SysIOCtl(fd, 4, Iface->HWAddr); - // TODO: Check if ioctl() failed + if( _SysIOCtl(fd, 4, Iface->HWAddr) ) { + perror("Getting MAC address"); + return -1; + } _SysClose(fd); }