summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-02-18 11:13:23 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-02-18 11:13:23 +0100
commit4d1fdfade0cfb51e9ff680861e3333bd2b24173a (patch)
tree39ce7b5d276134eb5de1625b0c4206d4c09d709e /src/core
parente263a847da839253e346fa3843aaf7cb90199f01 (diff)
downloadweechat-4d1fdfade0cfb51e9ff680861e3333bd2b24173a.zip
Give file descriptor to callback of hook_fd
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-hook.c3
-rw-r--r--src/core/wee-hook.h2
-rw-r--r--src/core/wee-network.c7
3 files changed, 8 insertions, 4 deletions
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index eab5ea6d1..cf07dd670 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -949,7 +949,8 @@ hook_fd_exec (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
&& (FD_ISSET(HOOK_FD(ptr_hook, fd), exception_fds)))))
{
ptr_hook->running = 1;
- (void) (HOOK_FD(ptr_hook, callback)) (ptr_hook->callback_data);
+ (void) (HOOK_FD(ptr_hook, callback)) (ptr_hook->callback_data,
+ HOOK_FD(ptr_hook, fd));
ptr_hook->running = 0;
}
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h
index 11801bc56..397156abf 100644
--- a/src/core/wee-hook.h
+++ b/src/core/wee-hook.h
@@ -126,7 +126,7 @@ struct t_hook_timer
struct timeval next_exec; /* next scheduled execution */
};
-typedef int (t_hook_callback_fd)(void *data);
+typedef int (t_hook_callback_fd)(void *data, int fd);
struct t_hook_fd
{
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index 3fb952095..10c8f12eb 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -752,7 +752,7 @@ network_connect_child (struct t_hook *hook_connect)
*/
int
-network_connect_child_read_cb (void *arg_hook_connect)
+network_connect_child_read_cb (void *arg_hook_connect, int fd)
{
struct t_hook *hook_connect;
char buffer[1], buf_size_ip[6], *ip_address, *error;
@@ -761,6 +761,9 @@ network_connect_child_read_cb (void *arg_hook_connect)
#ifdef HAVE_GNUTLS
int rc;
#endif
+
+ /* make C compiler happy */
+ (void) fd;
hook_connect = (struct t_hook *)arg_hook_connect;
@@ -914,7 +917,7 @@ network_connect_with_fork (struct t_hook *hook_connect)
HOOK_CONNECT(hook_connect, hook_fd) = hook_fd (NULL,
HOOK_CONNECT(hook_connect, child_read),
1, 0, 0,
- network_connect_child_read_cb,
+ &network_connect_child_read_cb,
hook_connect);
#endif
}