summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-16 00:52:22 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-16 00:52:22 +0800
commit4d00526c4b1a2cc3e60f5adcf7c8bb5a4dc20912 (patch)
treeb7fcc63228a4eb7f1096fc5080968ed2e9c39955
parent1f2456d052f54631285a96959e774c3f008846f1 (diff)
downloadpttbbs-4d00526c4b1a2cc3e60f5adcf7c8bb5a4dc20912.tar
pttbbs-4d00526c4b1a2cc3e60f5adcf7c8bb5a4dc20912.tar.gz
pttbbs-4d00526c4b1a2cc3e60f5adcf7c8bb5a4dc20912.tar.bz2
pttbbs-4d00526c4b1a2cc3e60f5adcf7c8bb5a4dc20912.tar.lz
pttbbs-4d00526c4b1a2cc3e60f5adcf7c8bb5a4dc20912.tar.xz
pttbbs-4d00526c4b1a2cc3e60f5adcf7c8bb5a4dc20912.tar.zst
pttbbs-4d00526c4b1a2cc3e60f5adcf7c8bb5a4dc20912.zip
verbose msg and skip multilogin check for debugsleeping
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3178 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/modes.h3
-rw-r--r--mbbsd/bbs.c4
-rw-r--r--mbbsd/mbbsd.c22
-rw-r--r--mbbsd/var.c2
4 files changed, 25 insertions, 6 deletions
diff --git a/include/modes.h b/include/modes.h
index 5166c1b6..d9e110e4 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -100,7 +100,8 @@
#define BLOGGING 80
#define CHESSWATCHING 81
#define GO 82
-#define MODE_MAX 82 /* 所有其他選單動態須在此之前 */
+#define DEBUGSLEEPING 83
+#define MODE_MAX 83 /* 所有其他選單動態須在此之前 */
/* menu.c 中的模式 */
#define QUIT 0x666 /* Return value to abort recursive functions */
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 1bda4b80..8bec2d6c 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -825,16 +825,16 @@ do_general(int isbid)
else if(!isbid)
{
/* general article */
+#ifdef USE_TEXTLEN
struct stat st;
- postfile.multi.money = aborted;
-#ifdef USE_TEXTLEN
if (stat(fpath, &st) != -1)
{
/* put original file (text) length. */
postfile.textlen = st.st_size;
}
#endif
+ postfile.multi.money = aborted;
}
strlcpy(postfile.owner, owner, sizeof(postfile.owner));
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 83bdc709..59ca1b1e 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -208,7 +208,7 @@ static void abort_bbs_debug(int sig) GCC_NORETURN;
static void
abort_bbs_debug(int sig)
{
- int i;
+ int i;
sigset_t sigset;
switch(sig) {
@@ -250,7 +250,8 @@ abort_bbs_debug(int sig)
/* log */
/* assume vsnprintf() in log_file() is signal-safe, is it? */
- log_file("log/crash.log", LOG_VF|LOG_CREAT, "%ld %d\n", time4(NULL), getpid());
+ log_file("log/crash.log", LOG_VF|LOG_CREAT,
+ "%ld %d\n", time4(NULL), getpid());
/* try logout... not a good idea, maybe crash again. now disabled */
/*
@@ -264,8 +265,14 @@ abort_bbs_debug(int sig)
#ifndef VALGRIND
setproctitle("debug me!(%d)(%s,%d)", sig, cuser.userid, currstat);
#endif
+ /* do this manually to prevent broken stuff */
+ /* will broken currutmp cause problems here? hope not... */
+ if(currutmp)
+ currutmp->mode = DEBUGSLEEPING;
+
sleep(3600); /* wait 60 mins for debug */
#endif
+
exit(0);
}
@@ -512,6 +519,16 @@ multi_user_check(void)
if (!(ui = (userinfo_t *) search_ulist(usernum)))
return; /* user isn't logged in */
+#ifdef DEBUGSLEEP
+ /* skip sleeping process */
+ while (ui->pid &&
+ (ui->uid == usernum && ui->mode == DEBUGSLEEPING))
+ ui++;
+
+ if(ui->uid != usernum)
+ return;
+#endif
+
pid = ui->pid;
if (!pid /* || (kill(pid, 0) == -1) */ )
return; /* stale entry in utmp file */
@@ -524,6 +541,7 @@ multi_user_check(void)
kill(pid, SIGHUP);
log_usies("KICK ", cuser.nickname);
} else {
+ /* what are we doing here? magic number 3? */
if (search_ulistn(usernum, 3) != NULL)
abort_bbs(0); /* Goodbye(); */
}
diff --git a/mbbsd/var.c b/mbbsd/var.c
index c8d8ef98..b024c793 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -269,6 +269,7 @@ char * const ModeTypeTable[MAX_MODES] = {
"部落格", /* BLOGGING */
"看棋", /* CHESSWATCHING */
"下圍棋", /* GO */
+ "[系統錯誤]", /* DEBUGSLEEPING */
"", /* for future usage */
"",
"",
@@ -311,7 +312,6 @@ char * const ModeTypeTable[MAX_MODES] = {
"",
"",
"",
- "",
""
};