Tap driver load fix.

This commit is contained in:
Adam Ierymenko 2015-04-14 19:21:56 -07:00
parent c9af603b9f
commit 508519b62a

View file

@ -344,8 +344,7 @@ OSXEthernetTap::OSXEthernetTap(
Mutex::Lock _gl(globalTapCreateLock);
if (stat("/dev/zt0",&stattmp)) {
if (homePath) {
if (::stat("/dev/zt0",&stattmp)) {
long kextpid = (long)vfork();
if (kextpid == 0) {
::chdir(homePath);
@ -357,11 +356,9 @@ OSXEthernetTap::OSXEthernetTap(
::waitpid(kextpid,&exitcode,0);
}
::usleep(500); // give tap device driver time to start up and try again
if (stat("/dev/zt0",&stattmp))
if (::stat("/dev/zt0",&stattmp))
throw std::runtime_error("/dev/zt# tap devices do not exist and cannot load tap.kext");
}
throw std::runtime_error("/dev/zt# tap devices do not exist and tap.kext not available");
}
// Try to reopen the last device we had, if we had one and it's still unused.
bool recalledDevice = false;