range-set: publish API for re-use by git-blame -L
[gitweb.git] / git.c
diff --git a/git.c b/git.c
index 02c3035d02d2156ace33c100ebffea75f532106b..2025f77d0181ba646e3c793a693e5d71348b966c 100644 (file)
--- a/git.c
+++ b/git.c
@@ -526,6 +526,13 @@ int main(int argc, char **av)
        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();
 
        /*