summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-merge.c2
-rw-r--r--builtin-receive-pack.c4
-rw-r--r--convert.c2
-rw-r--r--git.c4
-rw-r--r--ll-merge.c4
-rw-r--r--run-command.c9
-rw-r--r--run-command.h1
7 files changed, 7 insertions, 19 deletions
diff --git a/builtin-merge.c b/builtin-merge.c
index af9adab300..96ecaf4e48 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -594,7 +594,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
discard_cache();
if (read_cache() < 0)
die("failed to read the cache");
- return -ret;
+ return ret;
}
}
diff --git a/builtin-receive-pack.c b/builtin-receive-pack.c
index 6ec1d056e6..6235903552 100644
--- a/builtin-receive-pack.c
+++ b/builtin-receive-pack.c
@@ -143,8 +143,8 @@ static int run_status(int code, const char *cmd_name)
case -ERR_RUN_COMMAND_WAITPID_NOEXIT:
return error("%s died strangely", cmd_name);
default:
- error("%s exited with error code %d", cmd_name, -code);
- return -code;
+ error("%s exited with error code %d", cmd_name, code);
+ return code;
}
}
diff --git a/convert.c b/convert.c
index 1816e977b7..491e7141b4 100644
--- a/convert.c
+++ b/convert.c
@@ -267,7 +267,7 @@ static int filter_buffer(int fd, void *data)
status = finish_command(&child_process);
if (status)
- error("external filter %s failed %d", params->cmd, -status);
+ error("external filter %s failed %d", params->cmd, status);
return (write_err || status);
}
diff --git a/git.c b/git.c
index 65ed733fda..d223eab62f 100644
--- a/git.c
+++ b/git.c
@@ -418,9 +418,9 @@ static void execv_dashed_external(const char **argv)
*/
status = run_command_v_opt(argv, 0);
if (status != -ERR_RUN_COMMAND_EXEC) {
- if (IS_RUN_COMMAND_ERR(status))
+ if (status < 0)
die("unable to run '%s'", argv[0]);
- exit(-status);
+ exit(status);
}
errno = ENOENT; /* as if we called execvp */
diff --git a/ll-merge.c b/ll-merge.c
index a2c13c4c08..31c74578f6 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -192,10 +192,6 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
args[2] = cmd.buf;
status = run_command_v_opt(args, 0);
- if (status < -ERR_RUN_COMMAND_FORK)
- ; /* failure in run-command */
- else
- status = -status;
fd = open(temp[1], O_RDONLY);
if (fd < 0)
goto bad;
diff --git a/run-command.c b/run-command.c
index eb2efc3307..a4e309eeb9 100644
--- a/run-command.c
+++ b/run-command.c
@@ -241,14 +241,7 @@ static int wait_or_whine(pid_t pid)
if (!WIFEXITED(status))
return -ERR_RUN_COMMAND_WAITPID_NOEXIT;
code = WEXITSTATUS(status);
- switch (code) {
- case 127:
- return -ERR_RUN_COMMAND_EXEC;
- case 0:
- return 0;
- default:
- return -code;
- }
+ return code == 127 ? -ERR_RUN_COMMAND_EXEC : code;
}
}
diff --git a/run-command.h b/run-command.h
index e345502843..0211e1d471 100644
--- a/run-command.h
+++ b/run-command.h
@@ -10,7 +10,6 @@ enum {
ERR_RUN_COMMAND_WAITPID_SIGNAL,
ERR_RUN_COMMAND_WAITPID_NOEXIT,
};
-#define IS_RUN_COMMAND_ERR(x) (-(x) >= ERR_RUN_COMMAND_FORK)
struct child_process {
const char **argv;