Code

run_command: report system call errors instead of returning error codes
[git.git] / git.c
diff --git a/git.c b/git.c
index 5a00726d09a13d5f70ab0378e02bbbd299124d5c..03726eee5e186552b3eb11d3c8b357c006caa9f1 100644 (file)
--- a/git.c
+++ b/git.c
@@ -188,10 +188,9 @@ static int handle_alias(int *argcp, const char ***argv)
                                  alias_command);
 
                new_argv = xrealloc(new_argv, sizeof(char *) *
-                                   (count + *argcp + 1));
+                                   (count + *argcp));
                /* insert after command name */
                memcpy(new_argv + count, *argv + 1, sizeof(char *) * *argcp);
-               new_argv[count+*argcp] = NULL;
 
                *argv = new_argv;
                *argcp += count - 1;
@@ -246,7 +245,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 
        status = p->fn(argc, argv, prefix);
        if (status)
-               return status & 0xff;
+               return status;
 
        /* Somebody closed stdout? */
        if (fstat(fileno(stdout), &st))
@@ -327,6 +326,7 @@ static void handle_internal_command(int argc, const char **argv)
                { "merge-ours", cmd_merge_ours, RUN_SETUP },
                { "merge-recursive", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
                { "merge-subtree", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
+               { "mktree", cmd_mktree, RUN_SETUP },
                { "mv", cmd_mv, RUN_SETUP | NEED_WORK_TREE },
                { "name-rev", cmd_name_rev, RUN_SETUP },
                { "pack-objects", cmd_pack_objects, RUN_SETUP },
@@ -417,12 +417,8 @@ static void execv_dashed_external(const char **argv)
         * OK to return. Otherwise, we just pass along the status code.
         */
        status = run_command_v_opt(argv, 0);
-       if (status != -ERR_RUN_COMMAND_EXEC) {
-               if (IS_RUN_COMMAND_ERR(status))
-                       die("unable to run '%s'", argv[0]);
-               exit(-status);
-       }
-       errno = ENOENT; /* as if we called execvp */
+       if (status >= 0 || errno != ENOENT)
+               exit(status);
 
        argv[0] = tmp;