X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Flogger.c;h=caaf038d3b350d679f0ad8b2a2652b2cff099aa9;hb=28b7a53b693f6b4e70218a926e68a36ece54cda1;hp=1a2e95ffbeb779367bddba7f30bccddc55c6f8ba;hpb=0912276c6467aa3ee6f570b31245367319da572a;p=tinc diff --git a/src/logger.c b/src/logger.c index 1a2e95ff..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,8 +91,11 @@ 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. + } } } @@ -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; }