skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit 754da814c32de5fbbd8b065e9f106cbb7bfc8ae6
parent 686ca403f362ed0d92d94bec3f70984d5a012ca6
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Thu,  2 Sep 2021 16:25:02 +0000

 Don't forget child_spawn either

Signed-off-by: Laurent Bercot <ska@appnovation.com>

Diffstat:
Msrc/libstddjb/child_spawn.c | 8++++----
Msrc/libstddjb/child_spawn0.c | 12++++++------
Msrc/libstddjb/child_spawn1_internal.c | 8++++----
Msrc/libstddjb/child_spawn2.c | 8++++----
Msrc/libstddjb/child_spawn3.c | 8++++----
5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/libstddjb/child_spawn.c b/src/libstddjb/child_spawn.c @@ -136,16 +136,16 @@ pid_t child_spawn (char const *prog, char const *const *argv, char const *const syncdie: { - char c = errno ; - fd_write(syncpipe[1], &c, 1) ; + unsigned char c = errno ; + fd_write(syncpipe[1], (char *)&c, 1) ; } _exit(127) ; } fd_close(syncpipe[1]) ; { - char c ; - syncpipe[1] = fd_read(syncpipe[0], &c, 1) ; + unsigned char c ; + syncpipe[1] = fd_read(syncpipe[0], (char *)&c, 1) ; if (syncpipe[1]) { int e = c ; diff --git 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 ; diff --git a/src/libstddjb/child_spawn1_internal.c b/src/libstddjb/child_spawn1_internal.c @@ -99,8 +99,8 @@ pid_t child_spawn1_internal (char const *prog, char const *const *argv, char con syncdie: { - char c = errno ; - fd_write(syncpipe[1], &c, 1) ; + unsigned char c = errno ; + fd_write(syncpipe[1], (char *)&c, 1) ; } _exit(127) ; } @@ -108,8 +108,8 @@ pid_t child_spawn1_internal (char const *prog, char const *const *argv, char con fd_close(syncpipe[1]) ; { - char c ; - syncpipe[1] = fd_read(syncpipe[0], &c, 1) ; + unsigned char c ; + syncpipe[1] = fd_read(syncpipe[0], (char *)&c, 1) ; if (syncpipe[1]) { int e = c ; diff --git a/src/libstddjb/child_spawn2.c b/src/libstddjb/child_spawn2.c @@ -103,16 +103,16 @@ pid_t child_spawn2 (char const *prog, char const *const *argv, char const *const syncdie: { - char c = errno ; - fd_write(syncpipe[1], &c, 1) ; + unsigned char c = errno ; + fd_write(syncpipe[1], (char *)&c, 1) ; } _exit(127) ; } fd_close(syncpipe[1]) ; { - char c ; - syncpipe[1] = fd_read(syncpipe[0], &c, 1) ; + unsigned char c ; + syncpipe[1] = fd_read(syncpipe[0], (char *)&c, 1) ; if (syncpipe[1]) { int e = c ; diff --git a/src/libstddjb/child_spawn3.c b/src/libstddjb/child_spawn3.c @@ -112,16 +112,16 @@ pid_t child_spawn3 (char const *prog, char const *const *argv, char const *const syncdie: { - char c = errno ; - fd_write(syncpipe[1], &c, 1) ; + unsigned char c = errno ; + fd_write(syncpipe[1], (char *)&c, 1) ; } _exit(127) ; } fd_close(syncpipe[1]) ; { - char c ; - syncpipe[1] = fd_read(syncpipe[0], &c, 1) ; + unsigned char c ; + syncpipe[1] = fd_read(syncpipe[0], (char *)&c, 1) ; if (syncpipe[1]) { int e = c ;