From 19e0d449ebd06450c9d7f16f032c0806242c7515 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Wed, 20 May 2015 21:25:06 +0200 Subject: [PATCH] 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. --- src/logger.c | 3 ++- src/sptps_speed.c | 1 + src/sptps_test.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/logger.c b/src/logger.c index 8fbd344..ad7cef2 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 ab41e8d..d03246c 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 38c2c08..f83307f 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; -- 2.25.1