X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=merge-index.c;h=fa719cb0b1bd227423587c9e41eed77c755465a4;hb=e098368b5b990eb05cbc60a271ab6d731820e0c2;hp=7027d7865971646f178690a150246d9bc4d674c0;hpb=eec102524fda2df7d2846e865805ca213119bf10;p=git.git diff --git a/merge-index.c b/merge-index.c index 7027d7865..fa719cb0b 100644 --- a/merge-index.c +++ b/merge-index.c @@ -1,30 +1,17 @@ #include "cache.h" +#include "run-command.h" static const char *pgm; -static const char *arguments[8]; +static const char *arguments[9]; static int one_shot, quiet; static int err; static void run_program(void) { - pid_t pid = fork(); - int status; - - if (pid < 0) - die("unable to fork"); - if (!pid) { - execlp(pgm, arguments[0], - arguments[1], - arguments[2], - arguments[3], - arguments[4], - arguments[5], - arguments[6], - arguments[7], - NULL); - die("unable to execute '%s'", pgm); - } - if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) { + struct child_process child; + memset(&child, 0, sizeof(child)); + child.argv = arguments; + if (run_command(&child)) { if (one_shot) { err++; } else { @@ -38,7 +25,7 @@ static void run_program(void) static int merge_entry(int pos, const char *path) { int found; - + if (pos >= active_nr) die("git-merge-index: %s not in the cache", path); arguments[0] = pgm; @@ -49,6 +36,7 @@ static int merge_entry(int pos, const char *path) arguments[5] = ""; arguments[6] = ""; arguments[7] = ""; + arguments[8] = NULL; found = 0; do { static char hexbuf[4][60];