X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Fdhcpclient_src%2Fmain.c;h=643624a278f4e95d282665dd330094ba88affe8a;hb=956e8a29de884d0e12351552b6f4b5ad2e3c1b4c;hp=1bd7f1f71b6ff4ba5a7bf655922ffea6a8af9449;hpb=bfacdd3b71576cf6ceaa83352d3a7d162adb75e1;p=tpg%2Facess2.git diff --git a/Usermode/Applications/dhcpclient_src/main.c b/Usermode/Applications/dhcpclient_src/main.c index 1bd7f1f7..643624a2 100644 --- a/Usermode/Applications/dhcpclient_src/main.c +++ b/Usermode/Applications/dhcpclient_src/main.c @@ -109,6 +109,7 @@ int main(int argc, char *argv[]) { int maxfd; fd_set fds; + tInterface *p; maxfd = 0; FD_ZERO(&fds); @@ -123,8 +124,7 @@ int main(int argc, char *argv[]) return -1; } - _SysDebug("select returned"); - tInterface *p; + // Check for changes (with magic to allow inline deletion) for( p = (void*)&ifaces, i = ifaces; i; p=i,i = i->Next ) { if( FD_ISSET(i->SocketFD, &fds) ) @@ -158,17 +158,20 @@ void Scan_Dir(tInterface **IfaceList, const char *Directory) sprintf(path, "%s/%s", Directory, filename); fd = open(path, 0); + // Check if the device type is 9 (Network) if( ioctl(fd, 0, NULL) != 9 ) continue ; + // Check if it's a directory finfo(fd, &info, 0); - if( info.flags & FILEFLAG_DIRECTORY ) { + // If so, recurse Scan_Dir(IfaceList, path); } else { + // Otherwise, add it to the list tInterface *new = malloc(sizeof(tInterface) + pathlen); new->Adapter = (void*)(new + 1); strcpy(new->Adapter, path);