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.
This commit is contained in:
Guus Sliepen 2015-05-20 21:25:06 +02:00
parent 11868b890d
commit 19e0d449eb
3 changed files with 4 additions and 1 deletions

View file

@ -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);
}

View file

@ -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) {

View file

@ -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;