builtin/merge.c: drop a parameter that is never used
[gitweb.git] / run-command.c
index aece872e331caa28bf515c98f5cceb27d8414dff..3914d9c5117f29651b56772da143f0a226494a62 100644 (file)
@@ -76,7 +76,10 @@ static inline void close_pair(int fd[2])
 static inline void dup_devnull(int to)
 {
        int fd = open("/dev/null", O_RDWR);
-       dup2(fd, to);
+       if (fd < 0)
+               die_errno(_("open /dev/null failed"));
+       if (dup2(fd, to) < 0)
+               die_errno(_("dup2(%d,%d) failed"), fd, to);
        close(fd);
 }
 #endif
@@ -403,13 +406,12 @@ int start_command(struct child_process *cmd)
                                        unsetenv(*cmd->env);
                        }
                }
-               if (cmd->git_cmd) {
+               if (cmd->git_cmd)
                        execv_git_cmd(cmd->argv);
-               } else if (cmd->use_shell) {
+               else if (cmd->use_shell)
                        execv_shell_cmd(cmd->argv);
-               } else {
+               else
                        sane_execvp(cmd->argv[0], (char *const*) cmd->argv);
-               }
                if (errno == ENOENT) {
                        if (!cmd->silent_exec_failure)
                                error("cannot run %s: %s", cmd->argv[0],
@@ -443,7 +445,6 @@ int start_command(struct child_process *cmd)
                cmd->pid = -1;
        }
        close(notify_pipe[0]);
-
 }
 #else
 {
@@ -477,11 +478,10 @@ int start_command(struct child_process *cmd)
        if (cmd->env)
                env = make_augmented_environ(cmd->env);
 
-       if (cmd->git_cmd) {
+       if (cmd->git_cmd)
                cmd->argv = prepare_git_cmd(cmd->argv);
-       } else if (cmd->use_shell) {
+       else if (cmd->use_shell)
                cmd->argv = prepare_shell_cmd(cmd->argv);
-       }
 
        cmd->pid = mingw_spawnvpe(cmd->argv[0], cmd->argv, env, cmd->dir,
                                  fhin, fhout, fherr);