Don't enable device events when there is no valid filedescriptor.
This commit is contained in:
parent
108b238915
commit
37ccb325af
1 changed files with 7 additions and 5 deletions
|
@ -349,6 +349,7 @@ bool setup_myself(void) {
|
|||
if(!setup_device())
|
||||
return false;
|
||||
|
||||
if(device_fd >= 0) {
|
||||
event_set(&device_ev, device_fd, EV_READ|EV_PERSIST, handle_device_data, NULL);
|
||||
|
||||
if (event_add(&device_ev, NULL) < 0) {
|
||||
|
@ -356,6 +357,7 @@ bool setup_myself(void) {
|
|||
close_device();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Run tinc-up script to further initialize the tap interface */
|
||||
xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue