X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Flogger.c;h=caaf038d3b350d679f0ad8b2a2652b2cff099aa9;hb=8c10a4131f19dc27b0bc56ef48ae481d1fa03cb0;hp=55616fba09a4ac7b837bf84d22e7fb6456e8b9df;hpb=2c6b2d70e6640f39563ad7bb0aa0ba87f883848c;p=tinc diff --git a/src/logger.c b/src/logger.c index 55616fba..caaf038d 100644 --- a/src/logger.c +++ b/src/logger.c @@ -1,6 +1,6 @@ /* logger.c -- logging code - Copyright (C) 2004-2017 Guus Sliepen + Copyright (C) 2004-2022 Guus Sliepen 2004-2005 Ivo Timmermans This program is free software; you can redistribute it and/or modify @@ -91,16 +91,19 @@ static void real_logger(debug_t level, int priority, const char *message) { } if(umbilical && do_detach) { - write(umbilical, message, strlen(message)); - write(umbilical, "\n", 1); + size_t len = strlen(message); + + if(write(umbilical, message, len) != (ssize_t)len || write(umbilical, "\n", 1) != 1) { + // Other end broken, nothing we can do about it. + } } } - if(logcontrol && connection_list) { + if(logcontrol) { suppress = true; logcontrol = false; - for list_each(connection_t, c, connection_list) { + for list_each(connection_t, c, &connection_list) { if(!c->status.log) { continue; } @@ -113,7 +116,7 @@ static void real_logger(debug_t level, int priority, const char *message) { size_t len = strlen(message); - if(send_request(c, "%d %d %zu", CONTROL, REQ_LOG, len)) { + if(send_request(c, "%d %d %lu", CONTROL, REQ_LOG, (unsigned long)len)) { send_meta(c, message, len); } } @@ -220,7 +223,7 @@ void openlogger(const char *ident, logmode_t mode) { } } -void reopenlogger() { +void reopenlogger(void) { if(logmode != LOGMODE_FILE) { return; }