From 3f2a7a971a991aa5a02d9b30ea9779911b3b3300 Mon Sep 17 00:00:00 2001 From: des Date: Thu, 20 Dec 2007 13:57:31 +0000 Subject: [PATCH] When writing to a file, fflush() after every line so tail -F will work. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2324 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishncsa/varnishncsa.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/varnish-cache/bin/varnishncsa/varnishncsa.c b/varnish-cache/bin/varnishncsa/varnishncsa.c index 4d90f429..a20504e3 100644 --- a/varnish-cache/bin/varnishncsa/varnishncsa.c +++ b/varnish-cache/bin/varnishncsa/varnishncsa.c @@ -392,6 +392,10 @@ h_ncsa(void *priv, enum shmlogtag tag, unsigned fd, /* %{User-agent}i */ fprintf(fo, "\"%s\"\n", lp->df_User_agent ? lp->df_User_agent : "-"); + + /* hack: flush after every line if writing to file */ + if (fo != stdout) + fflush(fo); } /* clean up */ -- 2.39.5