} device_type = DEVICE_TYPE_TUN;
int device_fd = -1;
-static int if_fd = -1;
static int ip_fd = -1;
char *device = NULL;
char *iface = NULL;
}
}
+ int if_fd;
if((if_fd = open(device, O_RDWR, 0)) < 0) {
logger(DEBUG_ALWAYS, LOG_ERR, "Could not open %s: %s\n", device, strerror(errno));
return false;
}
}
- close(ip_fd);
- close(device_fd);
+ close(ip_fd); ip_fd = -1;
+ close(device_fd); device_fd = -1;
- free(device);
- free(iface);
+ free(device); device = NULL;
+ free(iface); iface = NULL;
}
static bool read_packet(vpn_packet_t *packet) {