mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
Fix doubly-linked list delete
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3234 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -938,14 +938,30 @@ outrun:
|
|||||||
} else {
|
} else {
|
||||||
/* Remove the user struct */
|
/* Remove the user struct */
|
||||||
if (user == conf->firstuser) {
|
if (user == conf->firstuser) {
|
||||||
user->nextuser->prevuser = NULL;
|
if (user->nextuser) {
|
||||||
|
/* There is another entry */
|
||||||
|
user->nextuser->prevuser = NULL;
|
||||||
|
} else {
|
||||||
|
/* We are the only entry */
|
||||||
|
conf->lastuser = NULL;
|
||||||
|
}
|
||||||
|
/* In either case */
|
||||||
conf->firstuser = user->nextuser;
|
conf->firstuser = user->nextuser;
|
||||||
} else if (user == conf->lastuser){
|
} else if (user == conf->lastuser){
|
||||||
user->prevuser->nextuser = NULL;
|
if (user->prevuser)
|
||||||
|
user->prevuser->nextuser = NULL;
|
||||||
|
else
|
||||||
|
ast_log(LOG_ERROR, "Bad bad bad! We're the last, not the first, but nobody before us??\n");
|
||||||
conf->lastuser = user->prevuser;
|
conf->lastuser = user->prevuser;
|
||||||
} else {
|
} else {
|
||||||
user->nextuser->prevuser = user->prevuser;
|
if (user->nextuser)
|
||||||
user->prevuser->nextuser = user->nextuser;
|
user->nextuser->prevuser = user->prevuser;
|
||||||
|
else
|
||||||
|
ast_log(LOG_ERROR, "Bad! Bad! Bad! user->nextuser is NULL but we're not the end!\n");
|
||||||
|
if (user->prevuser)
|
||||||
|
user->prevuser->nextuser = user->nextuser;
|
||||||
|
else
|
||||||
|
ast_log(LOG_ERROR, "Bad! Bad! Bad! user->prevuser is NULL but we're not the beginning!\n");
|
||||||
}
|
}
|
||||||
/* Return the number of seconds the user was in the conf */
|
/* Return the number of seconds the user was in the conf */
|
||||||
sprintf(meetmesecs, "%i", (int) (user->jointime - time(NULL)));
|
sprintf(meetmesecs, "%i", (int) (user->jointime - time(NULL)));
|
||||||
|
Reference in New Issue
Block a user