diff options
Diffstat (limited to 'src/libstddjb')
-rw-r--r-- | src/libstddjb/child_spawn-internal.h | 16 | ||||
-rw-r--r-- | src/libstddjb/child_spawn.c | 4 | ||||
-rw-r--r-- | src/libstddjb/child_spawn0.c | 6 | ||||
-rw-r--r-- | src/libstddjb/child_spawn1_internal.c | 4 | ||||
-rw-r--r-- | src/libstddjb/child_spawn2.c | 4 | ||||
-rw-r--r-- | src/libstddjb/child_spawn3.c | 4 | ||||
-rw-r--r-- | src/libstddjb/child_spawn_workaround.c | 17 | ||||
-rw-r--r-- | src/libstddjb/slurpn.c | 2 |
8 files changed, 14 insertions, 43 deletions
diff --git a/src/libstddjb/child_spawn-internal.h b/src/libstddjb/child_spawn-internal.h deleted file mode 100644 index b0f701c..0000000 --- a/src/libstddjb/child_spawn-internal.h +++ /dev/null @@ -1,16 +0,0 @@ -/* ISC license. */ - -#ifndef CHILD_SPAWN_INTERNAL_H -#define CHILD_SPAWN_INTERNAL_H - -#include <skalibs/sysdeps.h> - -#ifdef SKALIBS_HASPOSIXSPAWNEARLYRETURN - -#include <sys/types.h> - -extern pid_t child_spawn_workaround (pid_t, int const *) ; /* closes the pipe */ - -#endif - -#endif diff --git a/src/libstddjb/child_spawn.c b/src/libstddjb/child_spawn.c index e5f5115..7c59fba 100644 --- a/src/libstddjb/child_spawn.c +++ b/src/libstddjb/child_spawn.c @@ -20,10 +20,6 @@ #include <skalibs/config.h> #include <skalibs/env.h> -#ifdef SKALIBS_HASPOSIXSPAWNEARLYRETURN -# include "child_spawn-internal.h" -#endif - pid_t child_spawn (char const *prog, char const *const *argv, char const *const *envp, int *fds, unsigned int n) { pid_t pid ; diff --git a/src/libstddjb/child_spawn0.c b/src/libstddjb/child_spawn0.c index cfd78f8..ea7a5b1 100644 --- a/src/libstddjb/child_spawn0.c +++ b/src/libstddjb/child_spawn0.c @@ -11,11 +11,7 @@ #include <spawn.h> #include <skalibs/config.h> - -#ifdef SKALIBS_HASPOSIXSPAWNEARLYRETURN -# include <skalibs/djbunix.h> -# include "child_spawn-internal.h" -#endif +#include <skalibs/djbunix.h> pid_t child_spawn0 (char const *prog, char const *const *argv, char const *const *envp) { diff --git a/src/libstddjb/child_spawn1_internal.c b/src/libstddjb/child_spawn1_internal.c index 2fe0ee2..9e6eeff 100644 --- a/src/libstddjb/child_spawn1_internal.c +++ b/src/libstddjb/child_spawn1_internal.c @@ -14,10 +14,6 @@ #include <skalibs/config.h> -#ifdef SKALIBS_HASPOSIXSPAWNEARLYRETURN -# include "child_spawn-internal.h" -#endif - pid_t child_spawn1_internal (char const *prog, char const *const *argv, char const *const *envp, int *p, int to) { pid_t pid ; diff --git a/src/libstddjb/child_spawn2.c b/src/libstddjb/child_spawn2.c index 44d748f..986fd15 100644 --- a/src/libstddjb/child_spawn2.c +++ b/src/libstddjb/child_spawn2.c @@ -17,10 +17,6 @@ #include <skalibs/config.h> -#ifdef SKALIBS_HASPOSIXSPAWNEARLYRETURN -# include "child_spawn-internal.h" -#endif - pid_t child_spawn2 (char const *prog, char const *const *argv, char const *const *envp, int *fds) { pid_t pid ; diff --git a/src/libstddjb/child_spawn3.c b/src/libstddjb/child_spawn3.c index 81ffb0c..6eb7519 100644 --- a/src/libstddjb/child_spawn3.c +++ b/src/libstddjb/child_spawn3.c @@ -19,10 +19,6 @@ #include <skalibs/config.h> #include <skalibs/env.h> -#ifdef SKALIBS_HASPOSIXSPAWNEARLYRETURN -# include "child_spawn-internal.h" -#endif - pid_t child_spawn3 (char const *prog, char const *const *argv, char const *const *envp, int *fds) { pid_t pid ; diff --git a/src/libstddjb/child_spawn_workaround.c b/src/libstddjb/child_spawn_workaround.c index 516ade5..b5fb4f0 100644 --- a/src/libstddjb/child_spawn_workaround.c +++ b/src/libstddjb/child_spawn_workaround.c @@ -1,6 +1,7 @@ /* ISC license. */ #include <skalibs/sysdeps.h> +#include <skalibs/djbunix.h> #if defined(SKALIBS_HASPOSIXSPAWN) && defined(SKALIBS_HASPOSIXSPAWNEARLYRETURN) @@ -9,8 +10,8 @@ #include <sys/wait.h> #include <skalibs/allreadwrite.h> -#include <skalibs/djbunix.h> -#include "child_spawn-internal.h" + + /* when posix_spawn returns too early, you need this */ pid_t child_spawn_workaround (pid_t pid, int const *p) { @@ -41,8 +42,14 @@ pid_t child_spawn_workaround (pid_t pid, int const *p) #else - /* avoid empty TUs */ - -extern int skalibs_child_spawn_workaround_dummy_ ; +pid_t child_spawn_workaround (pid_t pid, int const *p) +{ + if (p) + { + fd_close(p[1]) ; + fd_close(p[0]) ; + } + return pid ; +} #endif diff --git a/src/libstddjb/slurpn.c b/src/libstddjb/slurpn.c index 317e300..d6a20da 100644 --- a/src/libstddjb/slurpn.c +++ b/src/libstddjb/slurpn.c @@ -16,7 +16,7 @@ int slurpn (int fd, stralloc *sa, size_t max) ssize_t r ; size_t n = max && sa->len + N > max ? max - sa->len : N ; if (!n) return (errno = ENOBUFS, 0) ; - if (!stralloc_readyplus(sa, n)) break ; + if (!stralloc_readyplus(sa, n)) return 0 ; r = fd_read(fd, sa->s + sa->len, n) ; switch (r) { |