Skip to content

Commit

Permalink
fix "tun_close" error
Browse files Browse the repository at this point in the history
modify “tun_close” to “tuntap_close” on OS X, to avoid compile error.
  • Loading branch information
SunYunxiao committed Nov 30, 2015
1 parent 3eb9869 commit 725bce7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions n2n_v1/tuntap_osx.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

#ifdef _DARWIN_

void tun_close(tuntap_dev *device);
void tuntap_close(tuntap_dev *device);

/* ********************************** */

#define N2N_OSX_TAPDEVICE_SIZE 32
int tuntap_open(tuntap_dev *device /* ignored */,
char *dev,
char *device_ip,
int tuntap_open(tuntap_dev *device /* ignored */,
char *dev,
char *device_ip,
char *device_mask,
const char * device_mac,
int mtu) {
Expand All @@ -42,7 +42,7 @@ int tuntap_open(tuntap_dev *device /* ignored */,
break;
}
}

if(device->fd < 0) {
traceEvent(TRACE_ERROR, "Unable to open tap device");
return(-1);
Expand Down Expand Up @@ -76,15 +76,15 @@ int tuntap_open(tuntap_dev *device /* ignored */,

fd = popen(buf, "r");
if(fd < 0) {
tun_close(device);
tuntap_close(device);
return(-1);
} else {
int a, b, c, d, e, f;

buf[0] = 0;
fgets(buf, sizeof(buf), fd);
pclose(fd);

if(buf[0] == '\0') {
traceEvent(TRACE_ERROR, "Unable to read tap%d interface MAC address");
exit(0);
Expand Down

0 comments on commit 725bce7

Please sign in to comment.