Zap next uid in clink_rem(), check it in clink_add()

The former ensures that next links are valid even for uids not on any
list.  The latter oopses on adding an uid to a list when it is already
on a list, unless it is at the tail.
This commit is contained in:
Markus Armbruster 2008-09-11 22:10:14 -04:00
parent 7441e2499f
commit b10ebe6992

View file

@ -144,6 +144,7 @@ clink_add(struct clink *cl, int type, int uid)
return;
if (CANT_HAPPEN(*head >= nclink[type]))
*head = -1;
CANT_HAPPEN(clink[type][uid].next >= 0);
clink[type][uid].next = *head;
*head = uid;
}
@ -171,6 +172,7 @@ clink_rem(struct clink *cl, int type, int uid)
}
*p = linkv[uid].next;
linkv[uid].next = -1;
}
/*