diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-01-08 10:05:18 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-01-08 10:05:18 +0800 |
commit | e6cb3dc46da35de0e371c6ea011929d73321e055 (patch) | |
tree | 7b57b61e3a573a4b04dc229a13c8a9eb970fe461 /mbbsd/cache.c | |
parent | 90e65d64e18735f59e72c06dbf8b9353b537044c (diff) | |
download | pttbbs-e6cb3dc46da35de0e371c6ea011929d73321e055.tar pttbbs-e6cb3dc46da35de0e371c6ea011929d73321e055.tar.gz pttbbs-e6cb3dc46da35de0e371c6ea011929d73321e055.tar.bz2 pttbbs-e6cb3dc46da35de0e371c6ea011929d73321e055.tar.lz pttbbs-e6cb3dc46da35de0e371c6ea011929d73321e055.tar.xz pttbbs-e6cb3dc46da35de0e371c6ea011929d73321e055.tar.zst pttbbs-e6cb3dc46da35de0e371c6ea011929d73321e055.zip |
- pmore: try to prevent munmap crash issue
- cache: skip DEBUGSLEEPING process
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3808 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/cache.c')
-rw-r--r-- | mbbsd/cache.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 5f15130a..6b5ef343 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -362,10 +362,30 @@ search_ulistn(int uid, int unum) if (j == 0) { for (; i > 0 && uid == SHM->uinfo[ulist[i - 1]].uid; --i) ;/* 指到第一筆 */ + // piaip Tue Jan 8 09:28:03 CST 2008 + // many people bugged about that their utmp have invalid + // entry on record. + // we found them caused by crash process (DEBUGSLEEPING) which + // may occupy utmp entries even after process was killed. + // because the memory is invalid, it is not safe for those process + // to wipe their utmp entry. it should be done by some external + // daemon. + // however, let's make a little workaround here... + for (; unum > 0 && i >= 0 && ulist[i] >= 0 && + SHM->uinfo[ulist[i]].uid == uid; unum--, i++) + { + if (SHM->uinfo[ulist[i]].mode == DEBUGSLEEPING) + unum ++; + } + if (unum == 0 && i > 0 && ulist[i-1] >= 0 && + SHM->uinfo[ulist[i-1]].uid == uid) + return &SHM->uinfo[ulist[i-1]]; + /* if ( i + unum - 1 >= 0 && (ulist[i + unum - 1] >= 0 && uid == SHM->uinfo[ulist[i + unum - 1]].uid ) ) return &SHM->uinfo[ulist[i + unum - 1]]; + */ break; /* 超過範圍 */ } if (end == start) { |