summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6119216)
raw | patch | inline | side by side (parent: 6119216)
author | Anders Melchiorsen <mail@cup.kalibalik.dk> | |
Mon, 4 Aug 2008 10:18:40 +0000 (12:18 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 5 Aug 2008 04:46:42 +0000 (21:46 -0700) |
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: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-ls-tree.c | patch | blob | history | |
run-command.c | patch | blob | history |
diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c
index d25767a1f7eb0a8b45bc1eed6b9aa95de0847f18..cb61717685b09a2e409440206e27fce68831e04d 100644 (file)
--- a/builtin-ls-tree.c
+++ b/builtin-ls-tree.c
/*
* 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)) {
diff --git a/run-command.c b/run-command.c
index 6af83c526ef8ddba7486457282e56093a9e3d0d4..bbb9c777e583c345d25a6651f9ddf7725c10f6af 100644 (file)
--- a/run-command.c
+++ b/run-command.c
trace_argv_printf(cmd->argv, "trace: run_command:");
#ifndef __MINGW32__
+ fflush(NULL);
cmd->pid = fork();
if (!cmd->pid) {
if (cmd->no_stdin)