nic: log errors in base-linux nic_drv

This commit is contained in:
Christian Helmuth 2014-06-04 16:40:35 +02:00 committed by Norman Feske
parent 7abc1733c5
commit 6f58cdffb6
1 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,7 @@
#include <nic/xml_node.h>
/* Linux */
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
@ -152,7 +153,10 @@ class Linux_driver : public Nic::Driver
int ret;
/* blocking-write packet to TAP */
do { ret = write(_tap_fd, packet, size); } while (ret < 0);
do {
ret = write(_tap_fd, packet, size);
if (ret < 0) PERR("write: errno=%d", errno);
} while (ret < 0);
}
@ -167,6 +171,7 @@ class Linux_driver : public Nic::Driver
/* blocking read incoming packet */
do {
ret = read(_tap_fd, _packet_buffer, sizeof(_packet_buffer));
if (ret < 0) PERR("read: errno=%d", errno);
} while (ret < 0);
void *buffer = _alloc.alloc(ret);