From 919bd1cabc73f19279bd94f8bbae1b26bee84e87 Mon Sep 17 00:00:00 2001 From: scw Date: Fri, 21 May 2004 06:48:51 +0000 Subject: Fix disconnection when leaving board. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2010 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/brc.c | 16 +++++++++++----- mbbsd/name.c | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mbbsd/brc.c b/mbbsd/brc.c index ede94386..7ad5e30c 100644 --- a/mbbsd/brc.c +++ b/mbbsd/brc.c @@ -184,16 +184,22 @@ brc_insert_record(brcbid_t bid, brcnbrd_t num, time_t* list) } else { /* ptr points to the old current brc list. * tmpp is the end of it (exclusive). */ - char *tmpp = ptr + sizeof(brcbid_t) + sizeof(brcnbrd_t) - + tnum * sizeof(time_t); + int len = sizeof(brcbid_t) + sizeof(brcnbrd_t) + tnum * sizeof(time_t); + char *tmpp = ptr + len; end_size = brc_buf + brc_size - tmpp; if (num) { + int sindex = ptr - brc_buf; new_size = sizeof(brcbid_t) + sizeof(brcnbrd_t) + num * sizeof(time_t); brc_size += new_size - (tmpp - ptr); - if (brc_size > brc_alloc && ! brc_enlarge_buf() ) { - end_size -= brc_size - BRC_MAXSIZE; - brc_size = BRC_MAXSIZE; + if (brc_size > brc_alloc) { + if (brc_enlarge_buf()) { + ptr = brc_buf + sindex; + tmpp = ptr + len; + } else { + end_size -= brc_size - BRC_MAXSIZE; + brc_size = BRC_MAXSIZE; + } } if (end_size > 0 && ptr + new_size != tmpp) memmove(ptr + new_size, tmpp, end_size); diff --git a/mbbsd/name.c b/mbbsd/name.c index 3cb2b698..9fe2ce97 100644 --- a/mbbsd/name.c +++ b/mbbsd/name.c @@ -2,7 +2,7 @@ #include "bbs.h" static word_t *current = NULL; -static char *msg_more = "\033[7m-- More --\033[m"; +static char *msg_more = "-- More --"; typedef char (*arrptr)[]; /* name complete for user ID */ -- cgit v1.2.3