From e2b4af20009f9963522b6e31c75b3f79b61f5394 Mon Sep 17 00:00:00 2001 From: piaip Date: Sun, 14 Jun 2009 17:26:24 +0000 Subject: * fix socket error handling (thanks to Kuang/wens) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4616 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- daemon/logind/logind.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'daemon/logind') diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c index d322e16c..3e411e02 100644 --- a/daemon/logind/logind.c +++ b/daemon/logind/logind.c @@ -1117,8 +1117,12 @@ client_cb(int fd, short event, void *arg) if ( (len = read(fd, buf, sizeof(buf))) <= 0) { - if (errno == EINTR || errno == EAGAIN) - return; + // case to continue: + if ((len < 0) && (errno == EINTR || errno == EAGAIN)) + return; + + // len == 0: EOF + // len < 0: any other error. // close connection login_conn_remove(conn, fd, 0); -- cgit v1.2.3