]> git.ipfire.org Git - thirdparty/git.git/blobdiff - merge-index.c
GIT-VERSION-FILE: check ./version first.
[thirdparty/git.git] / merge-index.c
index 727527fd59480a11a563108fa5d55a2696a40e98..a9983dd78ad5cd1e364f0e00c259bdb7e6f151f0 100644 (file)
@@ -1,16 +1,14 @@
-#include <sys/types.h>
-#include <sys/wait.h>
-
 #include "cache.h"
 
-static const char *pgm = NULL;
+static const char *pgm;
 static const char *arguments[8];
 static int one_shot, quiet;
 static int err;
 
 static void run_program(void)
 {
-       int pid = fork(), status;
+       pid_t pid = fork();
+       int status;
 
        if (pid < 0)
                die("unable to fork");
@@ -99,9 +97,15 @@ int main(int argc, char **argv)
 {
        int i, force_file = 0;
 
+       /* Without this we cannot rely on waitpid() to tell
+        * what happened to our children.
+        */
+       signal(SIGCHLD, SIG_DFL);
+
        if (argc < 3)
                usage("git-merge-index [-o] [-q] <merge-program> (-a | <filename>*)");
 
+       setup_git_directory();
        read_cache();
 
        i = 1;