mirror of https://github.com/deavmi/libtun.git
Added status of ioctl as return value when failed, fd when succeeded
This commit is contained in:
parent
bac2d3474a
commit
269f81904c
|
@ -35,9 +35,13 @@ int createTun(char* interfaceName, int iffFlags)
|
||||||
strcpy(interfaceReqData.ifr_name, interfaceName);
|
strcpy(interfaceReqData.ifr_name, interfaceName);
|
||||||
|
|
||||||
/* Attempt to bring up the tun device node */
|
/* Attempt to bring up the tun device node */
|
||||||
tunFD = ioctl(tunFD, TUNSETIFF, &interfaceReqData);
|
int tunStatus = ioctl(tunFD, TUNSETIFF, &interfaceReqData);
|
||||||
|
|
||||||
|
|
||||||
|
if(tunStatus < 0)
|
||||||
|
{
|
||||||
|
tunFD = tunStatus;
|
||||||
|
}
|
||||||
|
|
||||||
return tunFD;
|
return tunFD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue