int colourise = log->colourise;
char *buffer;
TALLOC_CTX *pool, *thread_log_pool;
- int ret = 0;
char const *fmt_colour = "";
char const *fmt_location = "";
char fmt_time[50];
len = talloc_array_length(buffer) - 1;
wrote = write(log->fd, buffer, len);
- if (wrote < len) ret = -1;
+ if (wrote < len) return;
}
break;
return -1;
}
- if (unlikely(setlinebuf(log->handle) < 0)) {
- fr_strerror_printf("Failed setting linebuf on file \"%s\": %s", file, fr_syserror(errno));
- fclose(log->handle);
- return -1;
- }
+ setlinebuf(log->handle);
return 0;
}
memset(log, 0, sizeof(*log));
log->dst = L_DST_SYSLOG;
- if (unlikely(log->handle = fopencookie(log, "w",
- (cookie_io_functions_t){
+ if (unlikely((log->handle = fopencookie(log, "w",
+ (cookie_io_functions_t){
.write = _syslog_write,
- }) == NULL)) {
+ })) == NULL)) {
fr_strerror_printf("Failed opening syslog transpor: %s", fr_syserror(errno));
return -1;
}
- if (unlikely(setlinebuf(log->handle) < 0)) {
- fr_strerror_printf("Failed setting linebuf on syslog transport: %s", fr_syserror(errno));
- fclose(log->handle);
- return -1;
- }
+ setlinebuf(log->handle);
return 0;
}
log->dst = L_DST_FUNC;
- if (unlikely(log->handle = fopencookie(log, "w",
- (cookie_io_functions_t){
+ if (unlikely((log->handle = fopencookie(log, "w",
+ (cookie_io_functions_t){
.write = write,
.close = close
- }) == NULL)) {
+ })) == NULL)) {
fr_strerror_printf("Failed opening func transport: %s", fr_syserror(errno));
return -1;
}
- if (unlikely(setlinebuf(log->handle) < 0)) {
- fr_strerror_printf("Failed setting linebuf on func transport: %s", fr_syserror(errno));
- fclose(log->handle);
- return -1;
- }
+ setlinebuf(log->handle);
log->uctx = uctx;
return 0;