diff options
-rw-r--r-- | package/deps.mak | 1 | ||||
-rw-r--r-- | src/libstddjb/cspawn_workaround.c | 55 |
2 files changed, 0 insertions, 56 deletions
diff --git a/package/deps.mak b/package/deps.mak index e595a26..dfaaac9 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -310,7 +310,6 @@ src/libstddjb/child_spawn2.o src/libstddjb/child_spawn2.lo: src/libstddjb/child_ src/libstddjb/child_spawn3.o src/libstddjb/child_spawn3.lo: src/libstddjb/child_spawn3.c src/include/skalibs/cspawn.h src/include/skalibs/djbunix.h src/include/skalibs/env.h src/include/skalibs/types.h src/libstddjb/coe.o src/libstddjb/coe.lo: src/libstddjb/coe.c src/include/skalibs/djbunix.h src/libstddjb/cspawn.o src/libstddjb/cspawn.lo: src/libstddjb/cspawn.c src/include/skalibs/allreadwrite.h src/include/skalibs/config.h src/include/skalibs/cspawn.h src/include/skalibs/djbunix.h src/include/skalibs/exec.h src/include/skalibs/selfpipe.h src/include/skalibs/sig.h src/include/skalibs/sysdeps.h -src/libstddjb/cspawn_workaround.o src/libstddjb/cspawn_workaround.lo: src/libstddjb/cspawn_workaround.c src/include/skalibs/allreadwrite.h src/include/skalibs/djbunix.h src/include/skalibs/sysdeps.h src/libstddjb/deepsleepuntil.o src/libstddjb/deepsleepuntil.lo: src/libstddjb/deepsleepuntil.c src/include/skalibs/iopause.h src/include/skalibs/tai.h src/libstddjb/devino_cmp.o src/libstddjb/devino_cmp.lo: src/libstddjb/devino_cmp.c src/include/skalibs/devino.h src/libstddjb/dir_close.o src/libstddjb/dir_close.lo: src/libstddjb/dir_close.c src/include/skalibs/direntry.h diff --git a/src/libstddjb/cspawn_workaround.c b/src/libstddjb/cspawn_workaround.c deleted file mode 100644 index da9bd89..0000000 --- a/src/libstddjb/cspawn_workaround.c +++ /dev/null @@ -1,55 +0,0 @@ -/* ISC license. */ - -#include <skalibs/sysdeps.h> -#include <skalibs/djbunix.h> - -#if defined(SKALIBS_HASPOSIXSPAWN) && defined(SKALIBS_HASPOSIXSPAWNEARLYRETURN) - -#include <errno.h> -#include <signal.h> -#include <sys/wait.h> - -#include <skalibs/allreadwrite.h> - - /* when posix_spawn returns too early, you need this */ - -pid_t cspawn_workaround (pid_t pid, int const *p) -{ - siginfo_t si ; - int e ; - ssize_t r ; - char c ; - - fd_close(p[1]) ; - r = fd_read(p[0], &c, 1) ; - fd_close(p[0]) ; - if (r == -1) return 0 ; - if (r) return (errno = EILSEQ, 0) ; /* child wrote, wtf */ - - do e = waitid(P_PID, pid, &si, WEXITED | WNOHANG | WNOWAIT) ; - while (e == -1 && errno == EINTR) ; - if (e == -1) return pid ; /* we're in trouble, but don't leak a child */ - if (!si.si_pid) return pid ; /* child is running */ - if (si.si_code != CLD_EXITED || si.si_status != 127) return pid ; /* child died after execve(), let caller handle it */ - /* - child exited 127, so either execve() failed, which is what we want to catch, - or it raced like a mofo, execve()d and then exited 127 on its own, in which - case, tough luck, it never existed. - */ - wait_pid(pid, 0) ; - return (errno = 0, 0) ; -} - -#else - -pid_t cspawn_workaround (pid_t pid, int const *p) -{ - if (p) - { - fd_close(p[1]) ; - fd_close(p[0]) ; - } - return pid ; -} - -#endif |