Skip to content
Snippets Groups Projects
Commit e825ade1 authored by g0dil's avatar g0dil
Browse files

Socket/Protocols/Raw: Use throwErrno() in TunTapSocketHandle

parent 895ef67d
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ prefix_ void senf::TapProtocol::init_client(std::string const & interface_name,
{
int fd;
if ( (fd = ::open("/dev/net/tun", O_RDWR)) < 0 )
throw SystemException(errno);
throwErrno();
struct ifreq ifr;
::memset( &ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TAP;
......@@ -58,7 +58,7 @@ prefix_ void senf::TapProtocol::init_client(std::string const & interface_name,
ifr.ifr_flags |= IFF_NO_PI;
interface_name.copy( ifr.ifr_name, IFNAMSIZ);
if (::ioctl(fd, TUNSETIFF, (void *) &ifr) < 0 )
throw SystemException(errno);
throwErrno();
body().fd(fd);
}
......@@ -75,7 +75,7 @@ prefix_ unsigned senf::TapProtocol::available()
return 0;
ssize_t l = ::recv(body().fd(),0,0,MSG_PEEK | MSG_TRUNC);
if (l < 0)
throw SystemException(errno);
throwErrno();
return l;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment