summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-06-07 14:17:34 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-06-07 14:17:34 +0000
commitf87d22c18774e32a26f6a22c850c8b3b0fa9cf5a (patch)
tree686ef07bf098b2a82f93015cb85496f87d0ca4be
parent8f05df1780d1827016fd2ab44b37d63d9f78cdb0 (diff)
always close sockets before calling hce_notify_done.
first spotted by Paulius Bulotas <paulius+openbsd-misc at devnull.lt>.
-rw-r--r--usr.sbin/hoststated/check_tcp.c6
-rw-r--r--usr.sbin/relayd/check_tcp.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/hoststated/check_tcp.c b/usr.sbin/hoststated/check_tcp.c
index 5b0b2521661..86e9525f035 100644
--- a/usr.sbin/hoststated/check_tcp.c
+++ b/usr.sbin/hoststated/check_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_tcp.c,v 1.24 2007/05/27 20:53:10 pyr Exp $ */
+/* $OpenBSD: check_tcp.c,v 1.25 2007/06/07 14:17:33 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -181,6 +181,7 @@ tcp_send_req(int s, short event, void *arg)
if (event == EV_TIMEOUT) {
cte->host->up = HOST_DOWN;
+ close(cte->s);
hce_notify_done(cte->host, "tcp_send_req: timeout");
return;
}
@@ -192,6 +193,7 @@ tcp_send_req(int s, short event, void *arg)
goto retry;
log_warnx("tcp_send_req: cannot send request");
cte->host->up = HOST_DOWN;
+ close(cte->s);
hce_notify_done(cte->host, "tcp_send_req: write");
return;
}
@@ -220,6 +222,7 @@ tcp_read_buf(int s, short event, void *arg)
if (event == EV_TIMEOUT) {
cte->host->up = HOST_DOWN;
buf_free(cte->buf);
+ close(s);
hce_notify_done(cte->host, "tcp_read_buf: timeout");
return;
}
@@ -232,6 +235,7 @@ tcp_read_buf(int s, short event, void *arg)
goto retry;
cte->host->up = HOST_DOWN;
buf_free(cte->buf);
+ close(cte->s);
hce_notify_done(cte->host, "tcp_read_buf: read failed");
return;;
case 0:
diff --git a/usr.sbin/relayd/check_tcp.c b/usr.sbin/relayd/check_tcp.c
index 5b0b2521661..86e9525f035 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.24 2007/05/27 20:53:10 pyr Exp $ */
+/* $OpenBSD: check_tcp.c,v 1.25 2007/06/07 14:17:33 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -181,6 +181,7 @@ tcp_send_req(int s, short event, void *arg)
if (event == EV_TIMEOUT) {
cte->host->up = HOST_DOWN;
+ close(cte->s);
hce_notify_done(cte->host, "tcp_send_req: timeout");
return;
}
@@ -192,6 +193,7 @@ tcp_send_req(int s, short event, void *arg)
goto retry;
log_warnx("tcp_send_req: cannot send request");
cte->host->up = HOST_DOWN;
+ close(cte->s);
hce_notify_done(cte->host, "tcp_send_req: write");
return;
}
@@ -220,6 +222,7 @@ tcp_read_buf(int s, short event, void *arg)
if (event == EV_TIMEOUT) {
cte->host->up = HOST_DOWN;
buf_free(cte->buf);
+ close(s);
hce_notify_done(cte->host, "tcp_read_buf: timeout");
return;
}
@@ -232,6 +235,7 @@ tcp_read_buf(int s, short event, void *arg)
goto retry;
cte->host->up = HOST_DOWN;
buf_free(cte->buf);
+ close(cte->s);
hce_notify_done(cte->host, "tcp_read_buf: read failed");
return;;
case 0: