X-Git-Url: https://git.distorted.org.uk/~mdw/secnet/blobdiff_plain/1b4ca45e628241eb21bd6f8fbc5ba3c647454db4..4bed5ad8e71ff84dc256291f823464b71e9a420a:/udp.c diff --git a/udp.c b/udp.c index fa42ba4..bb82026 100644 --- a/udp.c +++ b/udp.c @@ -105,7 +105,7 @@ static void udp_afterpoll(void *state, struct pollfd *fds, int nfds) BUF_ALLOC(st->rbuf,"udp_afterpoll"); buffer_init(st->rbuf,calculate_max_start_pad()); rv=recvfrom(st->fd, st->rbuf->start, - (st->rbuf->base + st->rbuf->len) - st->rbuf->start, + buf_remaining_space(st->rbuf), 0, (struct sockaddr *)&from, &fromlen); if (rv>0) { st->rbuf->size=rv; @@ -224,10 +224,7 @@ static void udp_phase_hook(void *sst, uint32_t new_phase) fatal_perror("udp (%s:%d): fcntl(set O_NONBLOCK)", st->loc.file,st->loc.line); } - if (fcntl(st->fd, F_SETFD, FD_CLOEXEC)==-1) { - fatal_perror("udp (%s:%d): fcntl(set FD_CLOEXEC)", - st->loc.file,st->loc.line); - } + setcloexec(st->fd); FILLZERO(addr); addr.sin_family=AF_INET;