void do_add(int cli_fd, struct be_msg *rmsg, struct ucred *cli_cred)
{
- static struct be_group *group = &group_head;
- static struct be_vc *prev_vc = NULL;
+
+ //brcm begin: static pointers of prev_vc,group has problems when delete is called in between adds
+ // static struct be_group *group = &group_head;
+ // static struct be_vc *prev_vc = NULL;
+ struct be_group *group = &group_head;
+ struct be_vc *prev_vc = NULL;
+ //brcm end
static char curr_groupname[MAX_GROUPNAME_LEN] = {};
static pid_t curr_cli_pid = 0;
which is non-constant. My intent is to keep most of the state
variables local to this function.
*/
-
- if(!group->head)
+ if(!group->head) {
group->head = new_vc;
- else if(prev_vc)
- prev_vc->next = new_vc;
+ }
+ else {
+ for(prev_vc = group->head; prev_vc->next != NULL; prev_vc=prev_vc->next) ;
- prev_vc = new_vc;
+ if(prev_vc) {
+ prev_vc->next = new_vc;
+ }
+ }
+ //brcm this has a problem if the VCC in the list is deleted
+ //prev_vc = new_vc;
smsg.msgtype = OK;
if( send(cli_fd, &smsg, sizeof(smsg), 0) < 0 )