summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2011-06-17 14:36:52 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2011-06-17 14:36:52 +0000
commit8d564978851e43aaf7dc702ba1f6218b2bc73a9e (patch)
tree3435518997284ee5cdb61d85eedbd116d51370d7 /usr.sbin/relayd
parent6461ee9d6b95a1d1635c0a4b8e3d5774f180367f (diff)
don't leak fds in failure path (ie when hosts are down)
from Martin Matuska in PR 6624 ok phessler@
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r--usr.sbin/relayd/check_tcp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/relayd/check_tcp.c b/usr.sbin/relayd/check_tcp.c
index d960f0aa6a7..49f7bb4f58f 100644
--- a/usr.sbin/relayd/check_tcp.c
+++ b/usr.sbin/relayd/check_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_tcp.c,v 1.41 2011/05/19 08:56:49 reyk Exp $ */
+/* $OpenBSD: check_tcp.c,v 1.42 2011/06/17 14:36:51 jsg Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -77,6 +77,8 @@ check_tcp(struct ctl_tcp_event *cte)
goto bad;
}
+ cte->s = s;
+
bzero(&lng, sizeof(lng));
if (setsockopt(s, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1)
goto bad;
@@ -100,7 +102,6 @@ check_tcp(struct ctl_tcp_event *cte)
cte->buf = NULL;
cte->host->up = HOST_UP;
- cte->s = s;
event_del(&cte->ev);
event_set(&cte->ev, s, EV_TIMEOUT|EV_WRITE, tcp_write, cte);
event_add(&cte->ev, &tv);