summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstddjb/cspawn.c7
-rw-r--r--src/sysdeps/trywaitid.c12
2 files changed, 18 insertions, 1 deletions
diff --git a/src/libstddjb/cspawn.c b/src/libstddjb/cspawn.c
index cb89481..ea0da90 100644
--- a/src/libstddjb/cspawn.c
+++ b/src/libstddjb/cspawn.c
@@ -96,7 +96,12 @@ static inline pid_t cspawn_fork (char const *prog, char const *const *argv, char
return pid ;
}
-#ifdef SKALIBS_HASPOSIXSPAWN
+ /*
+ guess who has a buggy posix_spawn() *and* doesn't have waitid() to work around it?
+ if you guessed OpenBSD, you're right!
+ */
+
+#if defined(SKALIBS_HASPOSIXSPAWN) && (!defined(SKALIBS_HASPOSIXSPAWNEARLYRETURN) || defined(SKALIBS_HASWAITID))
#include <signal.h>
#include <stdlib.h>
diff --git a/src/sysdeps/trywaitid.c b/src/sysdeps/trywaitid.c
new file mode 100644
index 0000000..76ceeea
--- /dev/null
+++ b/src/sysdeps/trywaitid.c
@@ -0,0 +1,12 @@
+/* ISC license. */
+
+#include <sys/types.h>
+#include <signal.h>
+#include <sys/wait.h>
+
+int main (void)
+{
+ siginfo_t info ;
+ waitid(P_PID, 0, &info, WEXITED) ;
+ return 0 ;
+}