X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=lib%2Flog%2Flog.c;h=41b44cc10ff9e02aa227d7ae0e4ccd3592052265;hp=e006fd0b1495c34867648ae58ff047113de751a6;hb=73df817d55376240d17ced8c2b6d89c4f17c4a63;hpb=dae4540e417e2bf72dd83b2713a670bde0056ba9 diff --git a/lib/log/log.c b/lib/log/log.c index e006fd0..41b44cc 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -4,6 +4,7 @@ #include "log.h" static FILE *logf; +static int always_flush; void pb_log(const char *fmt, ...) { @@ -15,9 +16,18 @@ void pb_log(const char *fmt, ...) va_start(ap, fmt); vfprintf(stream, fmt, ap); va_end(ap); + + if (always_flush) + fflush(stream); } void pb_log_set_stream(FILE *stream) { + fflush(logf ? logf : stdout); logf = stream; } + +void pb_log_always_flush(int state) +{ + always_flush = state; +}