2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

828. [bug] The errno value from recvfrom() could be overwritten

by logging code. [RT #1293]
This commit is contained in:
Andreas Gustafsson
2001-05-14 18:20:03 +00:00
parent 2510f0bd84
commit fd5847ef09
2 changed files with 10 additions and 5 deletions

View File

@@ -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 827. [bug] When an IXFR protocol error occurs, the slave
should retry with AXFR. should retry with AXFR.

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * 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 <config.h> #include <config.h>
@@ -861,6 +861,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
size_t actual_count; size_t actual_count;
struct msghdr msghdr; struct msghdr msghdr;
isc_buffer_t *buffer; isc_buffer_t *buffer;
int recv_errno;
#if USE_CMSG #if USE_CMSG
char cmsg[CMSG_BUF_SIZE]; char cmsg[CMSG_BUF_SIZE];
#else #else
@@ -874,9 +875,10 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
#endif #endif
cc = recvmsg(sock->fd, &msghdr, 0); cc = recvmsg(sock->fd, &msghdr, 0);
recv_errno = errno;
if (cc < 0) { if (cc < 0) {
if (SOFT_ERROR(errno)) if (SOFT_ERROR(recv_errno))
return (DOIO_SOFT); return (DOIO_SOFT);
if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) 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_msgcat, ISC_MSGSET_SOCKET,
ISC_MSG_DOIORECV, ISC_MSG_DOIORECV,
"doio_recv: recvmsg(%d) %d bytes, err %d/%s", "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) \ #define SOFT_OR_HARD(_system, _isc) \
if (errno == _system) { \ if (recv_errno == _system) { \
if (sock->connected) { \ if (sock->connected) { \
dev->result = _isc; \ dev->result = _isc; \
return (DOIO_HARD); \ return (DOIO_HARD); \
@@ -895,7 +897,7 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
return (DOIO_SOFT); \ return (DOIO_SOFT); \
} }
#define ALWAYS_HARD(_system, _isc) \ #define ALWAYS_HARD(_system, _isc) \
if (errno == _system) { \ if (recv_errno == _system) { \
dev->result = _isc; \ dev->result = _isc; \
return (DOIO_HARD); \ return (DOIO_HARD); \
} }