X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Ftincd.c;h=b62c8c1903a7cf30002b2a1a0ba57efd1f9ce2fa;hb=11868b890d1a7f4cfbfb37099393b32019010f66;hp=fb2a1557aa7fb0b59fd8e2d406c6cc0c189a5321;hpb=7f96ef081dc0dc41e3955e35c1a36a62fd47f72b;p=tinc diff --git a/src/tincd.c b/src/tincd.c index fb2a1557..b62c8c19 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -363,6 +363,14 @@ int main(int argc, char **argv) { logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "WSAStartup", winerror(GetLastError())); return 1; } +#else + // Check if we got an umbilical fd from the process that started us + char *umbstr = getenv("TINC_UMBILICAL"); + if(umbstr) { + umbilical = atoi(umbstr); + if(fcntl(umbilical, F_GETFL) < 0) + umbilical = 0; + } #endif openlogger("tinc", use_logfile?LOGMODE_FILE:LOGMODE_STDERR); @@ -466,6 +474,12 @@ int main2(int argc, char **argv) { logger(DEBUG_ALWAYS, LOG_NOTICE, "Ready"); + if(umbilical) { // snip! + write(umbilical, "", 1); + close(umbilical); + umbilical = 0; + } + try_outgoing_connections(); status = main_loop();