mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
remove unnecessary calls to fcntl().
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: context.c,v 1.25 2000/06/26 20:30:37 bwelling Exp $ */
|
||||
/* $Id: context.c,v 1.26 2000/07/07 19:10:00 bwelling Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -154,7 +154,7 @@ static void *
|
||||
lwres_malloc(void *arg, size_t len) {
|
||||
void *mem;
|
||||
|
||||
(void)arg;
|
||||
UNUSED(arg);
|
||||
|
||||
mem = malloc(len);
|
||||
if (mem == NULL)
|
||||
@@ -167,7 +167,7 @@ lwres_malloc(void *arg, size_t len) {
|
||||
|
||||
static void
|
||||
lwres_free(void *arg, void *mem, size_t len) {
|
||||
(void)arg;
|
||||
UNUSED(arg);
|
||||
|
||||
memset(mem, 0xa9, len);
|
||||
free(mem);
|
||||
@@ -207,7 +207,6 @@ lwres_context_sendrecv(lwres_context_t *ctx,
|
||||
{
|
||||
int ret;
|
||||
int ret2;
|
||||
int flags;
|
||||
struct sockaddr_in sin;
|
||||
LWRES_SOCKADDR_LEN_T fromlen;
|
||||
fd_set readfds;
|
||||
@@ -232,22 +231,10 @@ lwres_context_sendrecv(lwres_context_t *ctx,
|
||||
return (LWRES_R_IOERROR);
|
||||
|
||||
again:
|
||||
flags = fcntl(ctx->sock, F_GETFL, 0);
|
||||
flags |= O_NONBLOCK;
|
||||
ret = fcntl(ctx->sock, F_SETFL, flags);
|
||||
if (ret < 0)
|
||||
return (LWRES_R_IOERROR);
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
FD_SET(ctx->sock, &readfds);
|
||||
ret2 = select(ctx->sock + 1, &readfds, NULL, NULL, &timeout);
|
||||
|
||||
flags = fcntl(ctx->sock, F_GETFL, 0);
|
||||
flags &= ~O_NONBLOCK;
|
||||
ret = fcntl(ctx->sock, F_SETFL, flags);
|
||||
if (ret < 0)
|
||||
return (LWRES_R_IOERROR);
|
||||
|
||||
/*
|
||||
* What happened with select?
|
||||
*/
|
||||
|
Reference in New Issue
Block a user