summary refs log tree commit diff
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
parent686ca403f362ed0d92d94bec3f70984d5a012ca6 (diff)
downloadskalibs-754da814c32de5fbbd8b065e9f106cbb7bfc8ae6.tar.gz
skalibs-754da814c32de5fbbd8b065e9f106cbb7bfc8ae6.tar.xz
skalibs-754da814c32de5fbbd8b065e9f106cbb7bfc8ae6.zip
Don't forget child_spawn either
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--src/libstddjb/child_spawn.c8
-rw-r--r--src/libstddjb/child_spawn0.c12
-rw-r--r--src/libstddjb/child_spawn1_internal.c8
-rw-r--r--src/libstddjb/child_spawn2.c8
-rw-r--r--src/libstddjb/child_spawn3.c8
5 files changed, 22 insertions, 22 deletions
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 ;