summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h3
-rw-r--r--mbbsd/cache.c9
-rw-r--r--mbbsd/mbbsd.c3
3 files changed, 10 insertions, 5 deletions
diff --git a/include/proto.h b/include/proto.h
index fe8bad6c..2197427b 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.27 2002/08/20 02:42:36 in2 Exp $ */
+/* $Id: proto.h,v 1.28 2002/08/23 18:01:28 in2 Exp $ */
#ifndef INCLUDE_PROTO_H
#define INCLUDE_PROTO_H
@@ -117,6 +117,7 @@ int get_fileheader_cache(int bid, char *direct, fileheader_t *headers,
int recbase, int nlines);
void *attach_shm(int shmkey, int shmsize);
void attach_SHM(void);
+void sort_utmp();
/* cal */
int give_tax(int money);
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 */