summaryrefslogtreecommitdiffstats
path: root/mbbsd/mbbsd.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-04-18 22:07:08 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-04-18 22:07:08 +0800
commitd9268ea3021f7112244a894a33882edcc408bf1a (patch)
tree291838fcf20d715ec99c05716124a071c456108a /mbbsd/mbbsd.c
parentfee7749052ac9aab275c17be9e6bf923394b63f0 (diff)
downloadpttbbs-d9268ea3021f7112244a894a33882edcc408bf1a.tar
pttbbs-d9268ea3021f7112244a894a33882edcc408bf1a.tar.gz
pttbbs-d9268ea3021f7112244a894a33882edcc408bf1a.tar.bz2
pttbbs-d9268ea3021f7112244a894a33882edcc408bf1a.tar.lz
pttbbs-d9268ea3021f7112244a894a33882edcc408bf1a.tar.xz
pttbbs-d9268ea3021f7112244a894a33882edcc408bf1a.tar.zst
pttbbs-d9268ea3021f7112244a894a33882edcc408bf1a.zip
1. make tty_read more clear and reable
2. hack to prevent ^W SIGSEGV when parent is incorrect. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2697 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mbbsd.c')
-rw-r--r--mbbsd/mbbsd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 227e0f01..cc8afba3 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1595,15 +1595,15 @@ telnet_init(void)
/* tty_read
* read from tty, process telnet commands if raw connection.
- * return: >1 = length, -1 means read more, 0 = abort/EOF.
+ * return: >0 = length, <=0 means read more, abort/eof is automatically processed.
*/
ssize_t
tty_read(unsigned char *buf, size_t max)
{
ssize_t l = read(0, buf, max);
- if(l < 0 && !(errno == EINTR || errno == EAGAIN))
- return 0; /* 0 will abort BBS. */
+ if(l == 0 || (l < 0 && !(errno == EINTR || errno == EAGAIN)))
+ abort_bbs(0);
if(!raw_connection)
return l;