diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/cache.c | 9 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 7c4a1992..ccb8ff33 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -1,4 +1,4 @@ -/* $Id: cache.c,v 1.49 2002/08/20 02:42:36 in2 Exp $ */ +/* $Id: cache.c,v 1.50 2002/08/23 18:01:30 in2 Exp $ */ #include "bbs.h" #ifndef __FreeBSD__ @@ -527,8 +527,11 @@ search_ulistn(int uid, int unum) for (i = ((start + end) / 2);; i = (start + end) / 2) { j = uid - ulist[i]->uid; if (j == 0) { - for (; i > 0 && uid == ulist[i - 1]->uid; --i); /* 指到第一筆 */ - if (ulist[i + unum - 1] != NULL && uid == ulist[i + unum - 1]->uid) + for (; i > 0 && uid == ulist[i - 1]->uid; --i) + ;/* 指到第一筆 */ + if ( i + unum - 1 >= 0 && + (ulist[i + unum - 1] != NULL && + uid == ulist[i + unum - 1]->uid) ) return (userinfo_t *) (ulist[i + unum - 1]); break; /* 超過範圍 */ } diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 29121dd9..419c13e9 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1,4 +1,4 @@ -/* $Id: mbbsd.c,v 1.49 2002/08/23 11:33:01 in2 Exp $ */ +/* $Id: mbbsd.c,v 1.50 2002/08/23 18:01:30 in2 Exp $ */ #include "bbs.h" #define SOCKET_QLEN 4 @@ -448,6 +448,7 @@ multi_user_check() return; /* don't check sysops */ if (cuser.userlevel) { + sort_utmp(); if (!(ui = (userinfo_t *) search_ulist(usernum))) return; /* user isn't logged in */ |