summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-03-30 12:05:55 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-03-30 12:05:55 +0000
commitf13740d13df7585f62c2143512187aa4252fa781 (patch)
tree0f45a30877f734f2563e1b796aa19251a2eef86d /src
parent539bee3f515b13a9a55ce65c0c0593babc7c5048 (diff)
downloads6-dns-f13740d13df7585f62c2143512187aa4252fa781.tar.xz
Cosmetic fix: make sure there's no double close() in s6dns_enginev2.0.0.3
Diffstat (limited to 'src')
-rw-r--r--src/libs6dns/s6dns_engine.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c
index f795789..63d8dd6 100644
--- a/src/libs6dns/s6dns_engine.c
+++ b/src/libs6dns/s6dns_engine.c
@@ -162,7 +162,7 @@ static void prepare_next (s6dns_engine_t *dt, tain_t const *stamp, int istcp)
{
if (!error_isagain(errno))
{
- fd_close(dt->fd) ;
+ fd_close(dt->fd) ; dt->fd = -1 ;
dt->curserver++ ;
if (s6dns_engine_prepare(dt, stamp, istcp)) errno = EAGAIN ;
}
@@ -223,7 +223,7 @@ static int s6dns_engine_read_udp (s6dns_engine_t *dt, tain_t const *stamp)
s6dns_message_header_unpack(buf, &h) ;
if (h.tc)
{
- fd_close(dt->fd) ;
+ fd_close(dt->fd) ; dt->fd = -1 ;
dt->curserver = 0 ;
dt->protostate = 0 ;
if (s6dns_engine_prepare(dt, stamp, 1)) errno = EAGAIN ;
@@ -298,8 +298,7 @@ void s6dns_engine_recycle (s6dns_engine_t *dt)
if (dt->fd >= 0)
{
register int e = errno ;
- fd_close(dt->fd) ;
- dt->fd = -1 ;
+ fd_close(dt->fd) ; dt->fd = -1 ;
errno = e ;
}
dt->status = ECONNABORTED ;
@@ -313,7 +312,7 @@ int s6dns_engine_timeout (s6dns_engine_t *dt, tain_t const *stamp)
else if (!tain_less(&dt->localdeadline, stamp)) return 0 ;
else if (dt->flagwriting) goto yes ;
else if (!dt->flagreading) return 0 ;
- fd_close(dt->fd) ;
+ fd_close(dt->fd) ; dt->fd = -1 ;
dt->curserver++ ;
if (!s6dns_engine_prepare(dt, stamp, dt->flagtcp))
{