diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2024-04-15 13:19:13 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2024-04-15 13:19:13 +0000 |
commit | a27fb6dae5142a4220549845ef31516757ae6e4a (patch) | |
tree | f93f39adcd3bd6dbb955c7d0e1623670b1908cd5 /src/libexecline/el_execsequence.c | |
parent | a5b7a319fb558f5df599de286318029d455ed193 (diff) | |
download | execline-a27fb6dae5142a4220549845ef31516757ae6e4a.tar.gz execline-a27fb6dae5142a4220549845ef31516757ae6e4a.tar.xz execline-a27fb6dae5142a4220549845ef31516757ae6e4a.zip |
Use more accurate exit codes in backtick and foreground
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libexecline/el_execsequence.c')
-rw-r--r-- | src/libexecline/el_execsequence.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libexecline/el_execsequence.c b/src/libexecline/el_execsequence.c index 9d0993e..4a6cb28 100644 --- a/src/libexecline/el_execsequence.c +++ b/src/libexecline/el_execsequence.c @@ -2,6 +2,7 @@ #include <string.h> #include <unistd.h> +#include <errno.h> #include <skalibs/types.h> #include <skalibs/strerr.h> @@ -13,13 +14,14 @@ void el_execsequence (char const *const *argv1, char const *const *argv2, char const *const *envp) { size_t j = 2 ; - char fmt[UINT_FMT + 1] = "?=" ; + char fmt[UINT_FMT + 2] = "?=" ; pid_t pid = el_spawn0(argv1[0], argv1, envp) ; if (!pid) { + fmt[j++] = '1' ; + fmt[j++] = '2' ; + fmt[j++] = '6' + (errno == ENOENT) ; strerr_warnwu2sys("spawn ", argv1[0]) ; - memcpy(fmt+2, "127", 3) ; - j += 3 ; } else { |