On Mon, 2013-03-25 at 14:18 +0100, Michael Stapelberg wrote: > Package: qcontrol > Version: 0.4.2+svn-r40-3 > Severity: wishlist > > Attached you can find a patch which disables buffering of stdout when > stdout is not a tty. From the code: > > + /* Disable buffering for stdout if stdout is not a tty. > + * This is necessary when redirecting stdout to a file > + * or — as is the case with systemd — to the journal > + * socket. Otherwise, messages are only received very > + * rarely when the buffer fills up. */
Thanks for the patch. Do you not also care about stderr? Perhaps an explicit flush in print_log would be just as good, something like: diff --git a/qcontrol.c b/qcontrol.c index f143a8d..50cf1c8 100644 --- a/qcontrol.c +++ b/qcontrol.c @@ -92,13 +92,10 @@ int print_log(int priority, const char *format, ...) if (g_use_syslog == true) { vsyslog(priority, format, ap); } else { - if (priority == LOG_ERR) { - err = vfprintf(stderr, format, ap); - printf("\n"); - } else { - err = vprintf(format, ap); - printf("\n"); - } + FILE *f = (priority == LOG_ERR) ? stderr : stdout; + err = vfprintf(f, format, ap); + fprintf(f, "\n"); + fflush(f); } va_end(ap); Ian.
signature.asc
Description: This is a digitally signed message part