From 754da814c32de5fbbd8b065e9f106cbb7bfc8ae6 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 2 Sep 2021 16:25:02 +0000 Subject: Don't forget child_spawn either Signed-off-by: Laurent Bercot --- src/libstddjb/child_spawn.c | 8 ++++---- src/libstddjb/child_spawn0.c | 12 ++++++------ src/libstddjb/child_spawn1_internal.c | 8 ++++---- src/libstddjb/child_spawn2.c | 8 ++++---- src/libstddjb/child_spawn3.c | 8 ++++---- 5 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/libstddjb/child_spawn.c b/src/libstddjb/child_spawn.c index 4ac1dde..5a157a8 100644 --- 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 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 ; diff --git a/src/libstddjb/child_spawn1_internal.c b/src/libstddjb/child_spawn1_internal.c index 6b3dc91..436d19e 100644 --- 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 index 03db0d5..d35b4a6 100644 --- 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 index e1e433a..255e3c1 100644 --- 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 ; -- cgit v1.2.3