#include <netinet/in.h>
#include <arpa/inet.h>
#include "util.h"
+#include "magic.h"
#include "unaligned.h"
#include "ipaddr.h"
#include "magic.h"
fromlen=sizeof(from);
BUF_ASSERT_FREE(st->rbuf);
BUF_ALLOC(st->rbuf,"udp_afterpoll");
- rv=recvfrom(st->fd, st->rbuf->start, st->rbuf->len, 0,
- (struct sockaddr *)&from, &fromlen);
+ buffer_init(st->rbuf,calculate_max_start_pad());
+ rv=recvfrom(st->fd, st->rbuf->start,
+ buf_remaining_space(st->rbuf),
+ 0, (struct sockaddr *)&from, &fromlen);
if (rv>0) {
st->rbuf->size=rv;
if (st->use_proxy) {
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;