From fd5847ef0954117d5f905dbbfb68f1e67e4f285f Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Mon, 14 May 2001 18:20:03 +0000 Subject: [PATCH] 828. [bug] The errno value from recvfrom() could be overwritten by logging code. [RT #1293] --- CHANGES | 3 +++ lib/isc/unix/socket.c | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index e8deb01a16..893a5a27a9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,7 @@ + 828. [bug] The errno value from recvfrom() could be overwritten + by logging code. [RT #1293] + 827. [bug] When an IXFR protocol error occurs, the slave should retry with AXFR. diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index d0f6918834..991793f33b 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.198 2001/04/26 23:45:54 gson Exp $ */ +/* $Id: socket.c,v 1.199 2001/05/14 18:20:03 gson Exp $ */ #include @@ -861,6 +861,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) { size_t actual_count; struct msghdr msghdr; isc_buffer_t *buffer; + int recv_errno; #if USE_CMSG char cmsg[CMSG_BUF_SIZE]; #else @@ -874,9 +875,10 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) { #endif cc = recvmsg(sock->fd, &msghdr, 0); + recv_errno = errno; if (cc < 0) { - if (SOFT_ERROR(errno)) + if (SOFT_ERROR(recv_errno)) return (DOIO_SOFT); if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) @@ -884,10 +886,10 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) { isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_DOIORECV, "doio_recv: recvmsg(%d) %d bytes, err %d/%s", - sock->fd, cc, errno, strerror(errno)); + sock->fd, cc, recv_errno, strerror(recv_errno)); #define SOFT_OR_HARD(_system, _isc) \ - if (errno == _system) { \ + if (recv_errno == _system) { \ if (sock->connected) { \ dev->result = _isc; \ return (DOIO_HARD); \ @@ -895,7 +897,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) { return (DOIO_SOFT); \ } #define ALWAYS_HARD(_system, _isc) \ - if (errno == _system) { \ + if (recv_errno == _system) { \ dev->result = _isc; \ return (DOIO_HARD); \ }