Remove newlines at end of log messages.
This commit is contained in:
parent
05dac63dbc
commit
e9de08be0d
3 changed files with 9 additions and 5 deletions
|
@ -88,6 +88,7 @@ void reopenlogger() {
|
|||
|
||||
void logger(int level, int priority, const char *format, ...) {
|
||||
va_list ap;
|
||||
int len;
|
||||
char timestr[32] = "";
|
||||
char message[1024] = "";
|
||||
time_t now;
|
||||
|
@ -101,9 +102,12 @@ void logger(int level, int priority, const char *format, ...) {
|
|||
return;
|
||||
|
||||
va_start(ap, format);
|
||||
vsnprintf(message, sizeof message, format, ap);
|
||||
len = vsnprintf(message, sizeof message, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
if(len > 0 && len < sizeof message && message[len - 1] == '\n')
|
||||
message[len - 1] = 0;
|
||||
|
||||
if(level <= debug_level) {
|
||||
switch(logmode) {
|
||||
case LOGMODE_STDERR:
|
||||
|
|
|
@ -344,7 +344,7 @@ int reload_configuration(void) {
|
|||
|
||||
for(node = myself->subnet_tree->head; node; node = node->next) {
|
||||
subnet_t *subnet = node->data;
|
||||
logger(DEBUG_ALWAYS, LOG_DEBUG, "subnet %p expires %d\n", subnet, (int)subnet->expires);
|
||||
logger(DEBUG_ALWAYS, LOG_DEBUG, "subnet %p expires %d", subnet, (int)subnet->expires);
|
||||
if(!subnet->expires)
|
||||
subnet->expires = 1;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ int reload_configuration(void) {
|
|||
continue;
|
||||
|
||||
if((s2 = lookup_subnet(myself, subnet))) {
|
||||
logger(DEBUG_ALWAYS, LOG_DEBUG, "read subnet that already exists: %p expires %d\n", s2, (int)s2->expires);
|
||||
logger(DEBUG_ALWAYS, LOG_DEBUG, "read subnet that already exists: %p expires %d", s2, (int)s2->expires);
|
||||
if(s2->expires == 1)
|
||||
s2->expires = 0;
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ static void do_outgoing_pipe(connection_t *c, char *command) {
|
|||
int fd[2];
|
||||
|
||||
if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Could not create socketpair: %s\n", strerror(errno));
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Could not create socketpair: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ static void do_outgoing_pipe(connection_t *c, char *command) {
|
|||
|
||||
int result = system(command);
|
||||
if(result < 0)
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Could not execute %s: %s\n", command, strerror(errno));
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "Could not execute %s: %s", command, strerror(errno));
|
||||
else if(result)
|
||||
logger(DEBUG_ALWAYS, LOG_ERR, "%s exited with non-zero status %d", command, result);
|
||||
exit(result);
|
||||
|
|
Loading…
Reference in a new issue