summary refs log tree commit diff
path: root/www/git.causal.agency/cgit/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'www/git.causal.agency/cgit/cache.c')
-rw-r--r--www/git.causal.agency/cgit/cache.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/www/git.causal.agency/cgit/cache.c b/www/git.causal.agency/cgit/cache.c
index 2c70be78..580c0e80 100644
--- a/www/git.causal.agency/cgit/cache.c
+++ b/www/git.causal.agency/cgit/cache.c
@@ -265,6 +265,13 @@ static int process_slot(struct cache_slot *slot)
 {
 	int err;
 
+	/*
+	 * Make sure any buffered data is flushed before we redirect,
+	 * do sendfile(2) or write(2)
+	 */
+	if (fflush(stdout))
+		return errno;
+
 	err = open_slot(slot);
 	if (!err && slot->match) {
 		if (is_expired(slot)) {