]> git.ipfire.org Git - thirdparty/git.git/blobdiff - shell.c
glossary: define commit-ish (a.k.a. committish)
[thirdparty/git.git] / shell.c
diff --git a/shell.c b/shell.c
index 1429870a8f29d3d8b8e4d1d7ba3e228d15a73759..66350b220cc74abd383e10770f8325ba4e658e87 100644 (file)
--- a/shell.c
+++ b/shell.c
@@ -147,7 +147,6 @@ int main(int argc, char **argv)
        char *prog;
        const char **user_argv;
        struct commands *cmd;
-       int devnull_fd;
        int count;
 
        git_setup_gettext();
@@ -156,15 +155,10 @@ int main(int argc, char **argv)
 
        /*
         * Always open file descriptors 0/1/2 to avoid clobbering files
-        * in die().  It also avoids not messing up when the pipes are
-        * dup'ed onto stdin/stdout/stderr in the child processes we spawn.
+        * in die().  It also avoids messing up when the pipes are dup'ed
+        * onto stdin/stdout/stderr in the child processes we spawn.
         */
-       devnull_fd = open("/dev/null", O_RDWR);
-       while (devnull_fd >= 0 && devnull_fd <= 2)
-               devnull_fd = dup(devnull_fd);
-       if (devnull_fd == -1)
-               die_errno("opening /dev/null failed");
-       close (devnull_fd);
+       sanitize_stdfds();
 
        /*
         * Special hack to pretend to be a CVS server