From 7b77e66b07a9ce016902c5b9192e7ee10b87a796 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 24 Aug 2012 18:54:35 +0000 Subject: [PATCH] Workaround (leftover?) events after disable iSNS server git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4472 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/usr/isns.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/iscsi-scst/usr/isns.c b/iscsi-scst/usr/isns.c index 335db55b9..503697c83 100644 --- a/iscsi-scst/usr/isns.c +++ b/iscsi-scst/usr/isns.c @@ -971,6 +971,14 @@ static int scn_accept_connection(void) socklen_t slen; int fd, err, opt = 1; + if (isns_server == NULL) { + /* + * Sometimes we have (leftover?) events after disable iSNS + * server, so ignore them + */ + goto out; + } + slen = sizeof(from); fd = accept(scn_listen_fd, &from.sa, &slen); if (fd < 0) { @@ -989,6 +997,7 @@ static int scn_accept_connection(void) scn_fd = fd; isns_set_fd(isns_fd, scn_listen_fd, scn_fd); +out: return 0; }