From: Guus Sliepen Date: Wed, 20 May 2015 19:25:06 +0000 (+0200) Subject: Don't write log messages to the umbilical pipe if we don't detach. X-Git-Tag: release-1.1pre12~135 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=19e0d449ebd06450c9d7f16f032c0806242c7515;p=tinc Don't write log messages to the umbilical pipe if we don't detach. If we run in the foreground and are started by the CLI, this would otherwise cause the first few log messages to appear twice. --- diff --git a/src/logger.c b/src/logger.c index 8fbd3448..ad7cef28 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); } diff --git a/src/sptps_speed.c b/src/sptps_speed.c index ab41e8d5..d03246c5 100644 --- a/src/sptps_speed.c +++ b/src/sptps_speed.c @@ -33,6 +33,7 @@ bool send_request(void *c, const char *msg, ...) { return false; } struct list_t *connection_list = NULL; bool send_meta(void *c, const char *msg , int len) { return false; } char *logfilename = NULL; +bool do_detach = false; struct timeval now; static bool send_data(void *handle, uint8_t type, const void *data, size_t len) { diff --git a/src/sptps_test.c b/src/sptps_test.c index 38c2c08e..f83307fe 100644 --- a/src/sptps_test.c +++ b/src/sptps_test.c @@ -35,6 +35,7 @@ bool send_request(void *c, const char *msg, ...) { return false; } struct list_t *connection_list = NULL; bool send_meta(void *c, const char *msg , int len) { return false; } char *logfilename = NULL; +bool do_detach = false; struct timeval now; static bool verbose;