about summary refs log tree commit
path: root/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'cache.c')
-rw-r--r--cache.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cache.c b/cache.c
index 2c70be7..580c0e8 100644
--- a/cache.c
+++ b/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)) {