summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--exec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/exec.c b/exec.c
index 43ffad0..87bb5e6 100644
--- a/exec.c
+++ b/exec.c
@@ -368,12 +368,12 @@ static int bfs_exec_spawn(const struct bfs_exec *execbuf) {
return -1;
}
- errno = 0;
+ int ret = -1;
if (WIFEXITED(wstatus)) {
int status = WEXITSTATUS(wstatus);
if (status == EXIT_SUCCESS) {
- return 0;
+ ret = 0;
} else {
bfs_exec_debug(execbuf, "Command '%s' failed with status %d\n", execbuf->argv[0], status);
}
@@ -384,7 +384,8 @@ static int bfs_exec_spawn(const struct bfs_exec *execbuf) {
bfs_exec_debug(execbuf, "Command '%s' terminated abnormally\n", execbuf->argv[0]);
}
- return -1;
+ errno = 0;
+ return ret;
} else {
// Child
close(pipefd[0]);