mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
remove unnecessary calls to fcntl().
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* 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>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ static void *
|
|||||||
lwres_malloc(void *arg, size_t len) {
|
lwres_malloc(void *arg, size_t len) {
|
||||||
void *mem;
|
void *mem;
|
||||||
|
|
||||||
(void)arg;
|
UNUSED(arg);
|
||||||
|
|
||||||
mem = malloc(len);
|
mem = malloc(len);
|
||||||
if (mem == NULL)
|
if (mem == NULL)
|
||||||
@@ -167,7 +167,7 @@ lwres_malloc(void *arg, size_t len) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
lwres_free(void *arg, void *mem, size_t len) {
|
lwres_free(void *arg, void *mem, size_t len) {
|
||||||
(void)arg;
|
UNUSED(arg);
|
||||||
|
|
||||||
memset(mem, 0xa9, len);
|
memset(mem, 0xa9, len);
|
||||||
free(mem);
|
free(mem);
|
||||||
@@ -207,7 +207,6 @@ lwres_context_sendrecv(lwres_context_t *ctx,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int ret2;
|
int ret2;
|
||||||
int flags;
|
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
LWRES_SOCKADDR_LEN_T fromlen;
|
LWRES_SOCKADDR_LEN_T fromlen;
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
@@ -232,22 +231,10 @@ lwres_context_sendrecv(lwres_context_t *ctx,
|
|||||||
return (LWRES_R_IOERROR);
|
return (LWRES_R_IOERROR);
|
||||||
|
|
||||||
again:
|
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_ZERO(&readfds);
|
||||||
FD_SET(ctx->sock, &readfds);
|
FD_SET(ctx->sock, &readfds);
|
||||||
ret2 = select(ctx->sock + 1, &readfds, NULL, NULL, &timeout);
|
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?
|
* What happened with select?
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user