提交 7d0b18a4 编写于 作者: A Anders Melchiorsen 提交者: Junio C Hamano

Add output flushing before fork()

This adds fflush(NULL) before fork() in start_command(), to keep
the generic interface safe.

A remaining use of fork() with no flushing is in a comment in
show_tree(). Rewrite that comment to use start_command().
Signed-off-by: NAnders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 61192165
......@@ -66,17 +66,16 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,
/*
* Maybe we want to have some recursive version here?
*
* Something like:
* Something similar to this incomplete example:
*
if (show_subprojects(base, baselen, pathname)) {
if (fork()) {
chdir(base);
exec ls-tree;
}
waitpid();
struct child_process ls_tree;
ls_tree.dir = base;
ls_tree.argv = ls-tree;
start_command(&ls_tree);
}
*
* ..or similar..
*/
type = commit_type;
} else if (S_ISDIR(mode)) {
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册