[Patch 3/7] tabled: Stub NULL session in events

Pete Zaitcev <[email protected]>
Newsgroups org.kernel.vger.hail-devel
Message-ID <[email protected]>
Currently ncld has a bug that causes it to report a session failure
when session was not open yet. So, if a session fails to open,
application crashes while trying to print the SID. This problem
made this crash occur easily.

Unfortunately for us, there's more to it. If the library opened
session, but is pre-empted before ncld_sess_open returns, the
same situation may occur legitimately. So this check is still
needed, unless we radically change the locking strategy.

Signed-off-by: Pete Zaitcev <[email protected]>

---
 server/cldu.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

commit 446e8ca93ce624797a69841f38081faa369fee4a
Author: Pete Zaitcev <[email protected]>
Date:   Thu Apr 1 19:09:34 2010 -0600

    Stub the problem with failure to open.

diff --git a/server/cldu.c b/server/cldu.c
index aecf336..fadc3d8 100644
--- a/server/cldu.c
+++ b/server/cldu.c
@@ -176,8 +176,11 @@ static void cldu_sess_event(void *priv, uint32_t what)
 	struct cld_session *sp = priv;
 
 	if (what == CE_SESS_FAILED) {
-		applog(LOG_ERR, "Session failed, sid " SIDFMT,
-			       SIDARG(sp->nsp->udp->sess->sid));
+		if (sp->nsp)
+			applog(LOG_ERR, "Session failed, sid " SIDFMT,
+				       SIDARG(sp->nsp->udp->sess->sid));
+		else
+			applog(LOG_ERR, "Session open failed");
 		sp->is_dead = true;
 	} else {
 		if (sp->nsp)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.