List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH] ui-patch: Flush stdout after outputting data
Date: Wed, 11 Jun 2014 21:01:50 +0100	[thread overview]
Message-ID: <e5d12dc466aa3b894c03871c42638dd9108c83a2.1402516882.git.john@keeping.me.uk> (raw)
In-Reply-To: <5398B200.2080309@kernel.org>

Since the "html" functions use raw write(2) to STDIO_FILENO, we don't
notice problems with most pages, but raw patches write using printf(3).
This is fine if we're outputting straight to stdout since the buffers
are flushed on exit, but we close the cache output before this, so the
cached output ends up being truncated.

Make sure the buffers are flushed when we finish outputting a patch so
that we avoid this.

No other UIs use printf(3) so we do not need to worry about them.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 ui-patch.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ui-patch.c b/ui-patch.c
index 6878a46..fc6c145 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -82,4 +82,6 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
 		log_tree_commit(&rev, commit);
 		printf("-- \ncgit %s\n\n", cgit_version);
 	}
+
+	fflush(stdout);
 }
-- 
2.0.0.rc4.417.gc642ced



  reply	other threads:[~2014-06-11 20:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 19:46 Cache bug: cached patches truncated to nearest 1024-byte boundary mricon
2014-06-11 20:01 ` john [this message]
2014-06-11 20:28   ` [PATCH] ui-patch: Flush stdout after outputting data mricon
2014-06-11 20:55     ` john
2014-06-28 13:59       ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5d12dc466aa3b894c03871c42638dd9108c83a2.1402516882.git.john@keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).