/*
logger.c -- logging code
- Copyright (C) 2004-2017 Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2004-2022 Guus Sliepen <guus@tinc-vpn.org>
2004-2005 Ivo Timmermans
This program is free software; you can redistribute it and/or modify
}
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;
}
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);
}
}
}
}
-void reopenlogger() {
+void reopenlogger(void) {
if(logmode != LOGMODE_FILE) {
return;
}