Use read instead of recv, #58. Patch from Luigi Rizzo

This commit is contained in:
Erik Ekman 2009-05-14 18:12:38 +00:00
parent aa63a3514c
commit 91257baa3c

View File

@ -360,7 +360,8 @@ read_tun(int tun_fd, char *buf, size_t len)
#if defined (FREEBSD) || defined (DARWIN) || defined(NETBSD) || defined(WINDOWS32)
/* FreeBSD/Darwin/NetBSD has no header */
int bytes;
bytes = recv(tun_fd, buf + 4, len, 0);
memset(buf, 0, 4);
bytes = read(tun_fd, buf + 4, len - 4);
if (bytes < 0) {
return bytes;
} else {