repo: ngircd
action: commit
revision: 
path_from: 
revision_from: f9b9850662ee01aae9941bef611df5040b0ff2e0:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit f9b9850662ee01aae9941bef611df5040b0ff2e0
Author: Florian Westphal 
Date:   Thu Jan 18 00:25:26 2007 +0000

    io_event_add: return if eventtype is already registered.

diff --git a/src/ngircd/io.c b/src/ngircd/io.c
index 71ec3b40ccc2c5035d224d1bc37da021b6ecf7ce..
index ..660a1395b73519b7f7859f4eb326f392cb355c8c 100644
--- a/src/ngircd/io.c
+++ b/src/ngircd/io.c
@@ -12,7 +12,7 @@

 #include "portab.h"

-static char UNUSED id[] = "$Id: io.c,v 1.23 2006/12/26 16:00:46 alex Exp $";
+static char UNUSED id[] = "$Id: io.c,v 1.24 2007/01/18 00:25:26 fw Exp $";

 #include 
 #include 
@@ -463,7 +463,9 @@ io_event_add(int fd, short what)
 	io_event *i = io_event_get(fd);

 	if (!i) return false;
-	if (i->what == what) return true;
+
+	if ((i->what & what) == what) /* event type is already registered */
+		return true;
 #ifdef DEBUG_IO
 	Log(LOG_DEBUG, "io_event_add(): fd %d (arg: %d), what %d.", i->fd, fd, what);
 #endif

-----END OF PAGE-----