X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fiface-windows.c;h=1d8d0f3d9671c995f7b5316b057cd92b60484819;hb=aa30c333011fc09b057c0468151b73ba6828b25e;hp=9a57f7c2b7f8eda2268e7b740abb0fff17e3e841;hpb=2ac8137346a71d160c50e4e1ae5595b47739b71f;p=catta diff --git a/src/iface-windows.c b/src/iface-windows.c index 9a57f7c..1d8d0f3 100644 --- a/src/iface-windows.c +++ b/src/iface-windows.c @@ -471,8 +471,12 @@ int catta_interface_monitor_init_osdep(CattaInterfaceMonitor *m) catta_log_error("pipe() in catta_interface_monitor_init_osdep failed"); return -1; } - catta_set_nonblock(m->osdep.pipefd[0]); - catta_set_nonblock(m->osdep.pipefd[1]); + if(catta_set_nonblock(m->osdep.pipefd[0]) < 0 || + catta_set_nonblock(m->osdep.pipefd[1]) < 0) + { + catta_log_error(__FILE__": catta_set_nonblock failed: %s", errnostrsocket()); + goto fail; + } m->osdep.icnhandle = NULL; m->osdep.acnhandle = NULL; @@ -485,7 +489,7 @@ int catta_interface_monitor_init_osdep(CattaInterfaceMonitor *m) m); if(!m->osdep.watch) { catta_log_error(__FILE__": Failed to create watch."); - return -1; + goto fail; } // request async notification on interface changes @@ -505,6 +509,11 @@ int catta_interface_monitor_init_osdep(CattaInterfaceMonitor *m) catta_log_error("NotifyUnicastIpAddressChange failed: %u", (unsigned int)r); return 0; + +fail: + closesocket(m->osdep.pipefd[0]); + closesocket(m->osdep.pipefd[1]); + return -1; } void catta_interface_monitor_free_osdep(CattaInterfaceMonitor *m)