summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/git.c b/git.c
index c598dc6367..02b4b140ae 100644
--- a/git.c
+++ b/git.c
@@ -505,6 +505,13 @@ int main(int argc, const char **argv)
if (!cmd)
cmd = "git-help";
+ /*
+ * Always open file descriptors 0/1/2 to avoid clobbering files
+ * in die(). It also avoids messing up when the pipes are dup'ed
+ * onto stdin/stdout/stderr in the child processes we spawn.
+ */
+ sanitize_stdfds();
+
git_setup_gettext();
/*