From: John Hodge Date: Tue, 7 Feb 2012 08:36:42 +0000 (+0800) Subject: Usermode - Cleanups courtesey of scan-build X-Git-Tag: rel0.15~789^2~8 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=cca8ffc1a18df8f209670b7322d64c7298c0aee1;p=tpg%2Facess2.git Usermode - Cleanups courtesey of scan-build --- diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index 7f4ba01c..7abed27f 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -49,7 +49,6 @@ int main(int argc, char *argv[], char **envp) { char *sCommandStr; char *saArgs[32] = {0}; - int length = 0; int i; int iArgCount = 0; tReadline *readline_state = Readline_Init(1); @@ -80,7 +79,6 @@ int main(int argc, char *argv[], char **envp) // Read Command line sCommandStr = Readline( readline_state ); printf("\n"); - length = strlen(sCommandStr); // Parse Command Line into arguments iArgCount = Parse_Args(sCommandStr, saArgs); 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); diff --git a/Usermode/Applications/irc_src/main.c b/Usermode/Applications/irc_src/main.c index cf01d605..2bc0ee23 100644 --- a/Usermode/Applications/irc_src/main.c +++ b/Usermode/Applications/irc_src/main.c @@ -357,8 +357,7 @@ tMessage *Message_Append(tServer *Server, int Type, const char *Source, const ch // Determine if it's a channel or PM message else if( Dest[0] == '#' || Dest[0] == '&' ) // TODO: Better determining here { - tWindow *prev = NULL; - for(win = gpWindows; win; prev = win, win = win->Next) + for(win = gpWindows; win; win = win->Next) { if( win->Server == Server && strcmp(win->Name, Dest) == 0 ) { @@ -575,6 +574,7 @@ void ParseServerLine(tServer *Server, char *Line) char *class, *message; class = GetValue(Line, &pos); + _SysDebug("NOTICE class='%s'", class); if( Line[pos] == ':' ) { message = Line + pos + 1;