Fixed BUG in if_detach.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5159 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Waldemar Kornewald
2003-10-25 12:58:49 +00:00
parent 0868fe5619
commit 20826c8ed2
+14 -6
View File
@@ -398,12 +398,20 @@ void if_attach(struct ifnet *ifp)
void if_detach(struct ifnet *ifp)
{
struct ifnet **p = &devices, *q;
for (; (*p)->if_next != ifp ; (*p) = (*p)->if_next)
continue;
q = (*p)->if_next->if_next;
(*p)->if_next = q;
struct ifnet *p = devices, *q = NULL;
for(; p && p != ifp; p = p->if_next)
q = p;
if(!p)
return;
if(q)
q->if_next = p->if_next;
else
devices = p->if_next;
free(p->if_name);
}
/* XXX - memcpy used as copyin / copyout not available. I did look