diff options
author | midipix <writeonce@midipix.org> | 2018-07-13 11:43:21 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-07-13 12:17:11 -0400 |
commit | 86e387f3d29e0804c78eec41914e08b184c22a43 (patch) | |
tree | 05db6fdb715a8bb459f6f05946459a750e0ebd30 /src | |
parent | 77e6c6fd7c894ff6e4a9f53314049831c4b5c796 (diff) | |
download | slibtool-86e387f3d29e0804c78eec41914e08b184c22a43.tar.bz2 slibtool-86e387f3d29e0804c78eec41914e08b184c22a43.tar.xz |
internals: slbt_spawn(): always record process creation and execution errors.
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/slibtool_spawn_impl.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/internal/slibtool_spawn_impl.h b/src/internal/slibtool_spawn_impl.h index e4efda1..da2e762 100644 --- a/src/internal/slibtool_spawn_impl.h +++ b/src/internal/slibtool_spawn_impl.h @@ -9,6 +9,7 @@ #include <limits.h> #include <unistd.h> +#include <stdlib.h> #include <stdbool.h> #include <errno.h> #include <sys/wait.h> @@ -57,13 +58,18 @@ static inline int slbt_spawn( #endif - if (pid < 0) + if (pid < 0) { + ectx->pid = pid; + ectx->exitcode = errno; return -1; + } - if (pid == 0) - return execvp( + if (pid == 0) { + execvp( ectx->program, ectx->argv); + _exit(errno); + } errno = 0; ectx->pid = pid; |