summaryrefslogtreecommitdiff
path: root/src/libstddjb/child_spawn0.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-09-02 16:25:02 +0000
committerLaurent Bercot <ska@appnovation.com>2021-09-02 16:25:02 +0000
commit754da814c32de5fbbd8b065e9f106cbb7bfc8ae6 (patch)
treed94416601ba5bd57dfd532bbd99931b4e48edfa7 /src/libstddjb/child_spawn0.c
parent686ca403f362ed0d92d94bec3f70984d5a012ca6 (diff)
downloadskalibs-754da814c32de5fbbd8b065e9f106cbb7bfc8ae6.tar.xz
Don't forget child_spawn either
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb/child_spawn0.c')
-rw-r--r--src/libstddjb/child_spawn0.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libstddjb/child_spawn0.c b/src/libstddjb/child_spawn0.c
index 7b95b9f..927bb0e 100644
--- a/src/libstddjb/child_spawn0.c
+++ b/src/libstddjb/child_spawn0.c
@@ -55,8 +55,8 @@ pid_t child_spawn0 (char const *prog, char const *const *argv, char const *const
pid_t child_spawn0 (char const *prog, char const *const *argv, char const *const *envp)
{
pid_t pid ;
- int e ;
int p[2] ;
+ unsigned char c ;
if (pipecoe(p) < 0) return 0 ;
pid = fork() ;
if (pid < 0)
@@ -75,22 +75,22 @@ pid_t child_spawn0 (char const *prog, char const *const *argv, char const *const
fd_close(p[0]) ;
sig_blocknone() ;
exec_ae(prog, argv, envp) ;
- e = errno ;
- fd_write(p[1], (char *)&e, sizeof(e)) ;
+ c = errno ;
+ fd_write(p[1], (char *)&c, 1) ;
_exit(127) ;
}
fd_close(p[1]) ;
- p[1] = fd_read(p[0], (char *)&e, sizeof(e)) ;
+ p[1] = fd_read(p[0], (char *)&c, 1) ;
if (p[1] < 0)
{
fd_close(p[0]) ;
return 0 ;
}
fd_close(p[0]) ;
- if (p[1] == sizeof(e))
+ if (p[1])
{
wait_pid(pid, &p[0]) ;
- errno = e ;
+ errno = c ;
return 0 ;
}
return pid ;