X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Flogger.c;h=68a7fb2d0401207d1732e0dc29e1ddd50c3742af;hp=8fbd3448204d342ddd28427d9db1fdc979f3cf4f;hb=91355b9ac5a80d6d7da6951a72ea0c22651bdfa8;hpb=11868b890d1a7f4cfbfb37099393b32019010f66 diff --git a/src/logger.c b/src/logger.c index 8fbd3448..68a7fb2d 100644 --- a/src/logger.c +++ b/src/logger.c @@ -26,6 +26,7 @@ #include "logger.h" #include "connection.h" #include "control_common.h" +#include "process.h" #include "sptps.h" debug_t debug_level = DEBUG_NOTHING; @@ -80,7 +81,7 @@ static void real_logger(int level, int priority, const char *message) { break; } - if(umbilical) { + if(umbilical && do_detach) { write(umbilical, message, strlen(message)); write(umbilical, "\n", 1); } @@ -126,6 +127,8 @@ static void sptps_logger(sptps_t *s, int s_errno, const char *format, va_list ap if(message[len - 1] == '\n') message[--len] = 0; + // WARNING: s->handle can point to a connection_t or a node_t, + // but both types have the name and hostname fields at the same offsets. connection_t *c = s->handle; if(c) snprintf(message + len, sizeof message - len, " from %s (%s)", c->name, c->hostname);