summaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-09-10 20:33:01 -0400
committerTavian Barnes <tavianator@tavianator.com>2018-09-10 20:33:01 -0400
commitfc76667077c0b6f769501d1bb25b1b41d5c38bf5 (patch)
tree641a6295a318135493254e72a6e7264239d02118 /exec.c
parent5529a7006ae22df4ea69e06121bd0111fa52e45c (diff)
downloadbfs-fc76667077c0b6f769501d1bb25b1b41d5c38bf5.tar.xz
exec: More fixes for bfs_exec_debug() changing errno
Diffstat (limited to 'exec.c')
-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]);