From 07b831073c7937008e0fd978edafc672424e449e Mon Sep 17 00:00:00 2001 From: kcwu Date: Sun, 27 Mar 2005 01:28:29 +0000 Subject: show message to tell user crash git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2674 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mbbsd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'mbbsd') diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 5fe235e6..9a9b0ea7 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -202,13 +202,19 @@ abort_bbs_debug(int sig) { #ifdef DEBUGSLEEP static int reentrant = 0; +#endif +#define CRASH_MSG "\033[0m\r\n程式異常, 立刻斷線. 請洽 PttBug 板詳述你發生的問題.\n" + /* NOTE: It's better to use signal-safe functions. Avoid to call + * functions with global/static variable -- data may be corrupted */ + write(1, CRASH_MSG, sizeof(CRASH_MSG)); +#ifdef DEBUGSLEEP if (!reentrant) { int i; + reentrant = 1; /* close all file descriptors (including the network connection) */ for (i = 0; i < 256; ++i) close(i); - reentrant = 1; if (currmode) u_exit("AXXED"); #ifndef VALGRIND -- cgit v1.2.3