From efb1d08613948b52c2a3431e6e4b106f37ecca4a Mon Sep 17 00:00:00 2001
From: nenolod <devnull@localhost>
Date: Sat, 7 Jul 2007 01:08:23 -0700
Subject: [PATCH] [svn] - fix dereference problems with not widely used polling
 engines

---
 ChangeLog             | 9 +++++++++
 include/serno.h       | 2 +-
 libcharybdis/poll.c   | 5 ++++-
 libcharybdis/select.c | 6 ++++--
 4 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 08a341c9..f8a0f186 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+nenolod     2007/07/06 07:56:14 UTC	(20070706-3526)
+  Log:
+  - forgot to do something
+  
+
+  Changes:	Modified:
+  +3 -0		trunk/extensions/ip_cloaking.c (File Modified) 
+
+
 nenolod     2007/07/06 07:54:54 UTC	(20070706-3524)
   Log:
   - fix a possible problem with ipv6
diff --git a/include/serno.h b/include/serno.h
index 3e0f4aad..095d095a 100644
--- a/include/serno.h
+++ b/include/serno.h
@@ -1 +1 @@
-#define SERNO "20070706-3524"
+#define SERNO "20070706-3526"
diff --git a/libcharybdis/poll.c b/libcharybdis/poll.c
index 8023b112..407fb619 100644
--- a/libcharybdis/poll.c
+++ b/libcharybdis/poll.c
@@ -22,7 +22,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: poll.c 3354 2007-04-03 09:21:31Z nenolod $
+ *  $Id: poll.c 3528 2007-07-07 08:08:23Z nenolod $
  */
 
 #include "config.h"
@@ -128,6 +128,9 @@ poll_update_pollfds(int fd, short event, PF * handler)
 
 	resize_poll_array(fd);
 
+	if (F == NULL)
+		F = comm_add_fd(fd);
+
 	if(F->comm_index < 0)
 		F->comm_index = poll_findslot();
 
diff --git a/libcharybdis/select.c b/libcharybdis/select.c
index b673e0ac..d019203c 100644
--- a/libcharybdis/select.c
+++ b/libcharybdis/select.c
@@ -22,7 +22,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: select.c 3354 2007-04-03 09:21:31Z nenolod $
+ *  $Id: select.c 3528 2007-07-07 08:08:23Z nenolod $
  */
 
 #include "config.h"
@@ -104,7 +104,9 @@ comm_setselect(int fd, fdlist_t list, unsigned int type, PF * handler,
 {
 	fde_t *F = comm_locate_fd(fd);
 	s_assert(fd >= 0);
-	s_assert(F->flags.open);
+
+	if (!F)
+		F = comm_add_fd(fd);
 
 	if(type & COMM_SELECT_READ)
 	{