summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-04-19 14:48:45 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-04-19 14:48:45 +0000
commit33c8d44b3b0588154af50a728041c80637518975 (patch)
tree951e5789f3e41f578c273a9117568d25ac0b9ec0
parent45c1fc3b6ccd6fbd8f60293fc1e9609f18e7fe05 (diff)
relayd re-uses the event callbacks and passes the value of iev.data
as the third argument (so that should be a copy of the 5th argument of event_set(). it boggles the mind.
-rw-r--r--usr.sbin/relayd/control.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/relayd/control.c b/usr.sbin/relayd/control.c
index 345bffe59a8..275dd925713 100644
--- a/usr.sbin/relayd/control.c
+++ b/usr.sbin/relayd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.42 2012/04/11 08:33:53 deraadt Exp $ */
+/* $OpenBSD: control.c,v 1.43 2012/04/19 14:48:44 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -175,6 +175,7 @@ control_accept(int listenfd, short event, void *arg)
imsg_init(&c->iev.ibuf, connfd);
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
+ c->iev.data = cs; /* proc.c cheats (reuses the handler) */
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
c->iev.handler, cs);
event_add(&c->iev.ev, NULL);
@@ -223,7 +224,7 @@ control_close(int fd, struct control_sock *cs)
void
control_dispatch_imsg(int fd, short event, void *arg)
{
- struct control_sock *cs = (struct control_sock *)arg;
+ struct control_sock *cs = arg;
struct ctl_conn *c;
struct imsg imsg;
struct ctl_id id;