diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2018-09-10 20:33:01 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2018-09-10 20:33:01 -0400 |
commit | fc76667077c0b6f769501d1bb25b1b41d5c38bf5 (patch) | |
tree | 641a6295a318135493254e72a6e7264239d02118 /exec.c | |
parent | 5529a7006ae22df4ea69e06121bd0111fa52e45c (diff) | |
download | bfs-fc76667077c0b6f769501d1bb25b1b41d5c38bf5.tar.xz |
exec: More fixes for bfs_exec_debug() changing errno
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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]); |