From: Dave West Date: Tue, 18 Mar 2008 14:59:28 +0000 (+0000) Subject: RWHO command uses new function to read the context list safely. X-Git-Tag: v7.86~2417 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=e5f3baf6c110760b7a8a205dda834b1c4a2446e5;p=citadel.git RWHO command uses new function to read the context list safely. --- diff --git a/citadel/modules/rwho/serv_rwho.c b/citadel/modules/rwho/serv_rwho.c index 06f439081..515c5f6af 100644 --- a/citadel/modules/rwho/serv_rwho.c +++ b/citadel/modules/rwho/serv_rwho.c @@ -68,8 +68,7 @@ void cmd_rwho(char *argbuf) { */ - nContexts = num_sessions; - nptr = malloc(sizeof(struct CitContext) * nContexts); + nptr = CtdlGetContextArray(&nContexts) ; if (!nptr) { /* Couldn't malloc so we have to bail but stick to the protocol */ @@ -77,12 +76,6 @@ void cmd_rwho(char *argbuf) { cprintf("000\n"); return; } - begin_critical_section(S_SESSION_TABLE); - for (cptr = ContextList, i=0; cptr != NULL && i < nContexts; cptr = cptr->next, i++) - { - memcpy(&nptr[i], cptr, sizeof (struct CitContext)); - } - end_critical_section (S_SESSION_TABLE); aide = CC->user.axlevel >= 6; cprintf("%d%c \n", LISTING_FOLLOWS, CtdlCheckExpress() );