Make git archive respect core.autocrlf when creating zip format archives
[gitweb.git] / run-command.c
index a3b28a64dc2d1b888b0ba2a135be10fe04651201..bbb9c777e583c345d25a6651f9ddf7725c10f6af 100644 (file)
@@ -68,6 +68,7 @@ int start_command(struct child_process *cmd)
        trace_argv_printf(cmd->argv, "trace: run_command:");
 
 #ifndef __MINGW32__
+       fflush(NULL);
        cmd->pid = fork();
        if (!cmd->pid) {
                if (cmd->no_stdin)
@@ -304,6 +305,9 @@ int start_async(struct async *async)
        async->out = pipe_out[0];
 
 #ifndef __MINGW32__
+       /* Flush stdio before fork() to avoid cloning buffers */
+       fflush(NULL);
+
        async->pid = fork();
        if (async->pid < 0) {
                error("fork (async) failed: %s", strerror(errno));