projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix for botched cherry-pick commit 60fb230.
[tinc]
/
src
/
logger.c
diff --git
a/src/logger.c
b/src/logger.c
index
2defb23
..
e46d926
100644
(file)
--- a/
src/logger.c
+++ b/
src/logger.c
@@
-26,6
+26,7
@@
#include "logger.h"
#include "connection.h"
#include "control_common.h"
#include "logger.h"
#include "connection.h"
#include "control_common.h"
+#include "process.h"
#include "sptps.h"
debug_t debug_level = DEBUG_NOTHING;
#include "sptps.h"
debug_t debug_level = DEBUG_NOTHING;
@@
-37,7
+38,7
@@
static HANDLE loghandle = NULL;
#endif
static const char *logident = NULL;
bool logcontrol = false;
#endif
static const char *logident = NULL;
bool logcontrol = false;
-
+int umbilical = 0;
static void real_logger(int level, int priority, const char *message) {
char timestr[32] = "";
static void real_logger(int level, int priority, const char *message) {
char timestr[32] = "";
@@
-79,6
+80,11
@@
static void real_logger(int level, int priority, const char *message) {
case LOGMODE_NULL:
break;
}
case LOGMODE_NULL:
break;
}
+
+ if(umbilical && do_detach) {
+ write(umbilical, message, strlen(message));
+ write(umbilical, "\n", 1);
+ }
}
if(logcontrol) {
}
if(logcontrol) {
@@
-121,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;
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);
connection_t *c = s->handle;
if(c)
snprintf(message + len, sizeof message - len, " from %s (%s)", c->name, c->hostname);
@@
-202,6
+210,5
@@
void closelogger(void) {
case LOGMODE_NULL:
case LOGMODE_STDERR:
break;
case LOGMODE_NULL:
case LOGMODE_STDERR:
break;
- break;
}
}
}
}