+2024-08-30 Bruno Haible <bruno@clisp.org>
+
+ posix_openpt tests: Fix test failure on Haiku.
+ * tests/test-posix_openpt.c (main): On Haiku, create a child process and
+ call setsid().
+
2024-08-30 Bruno Haible <bruno@clisp.org>
sigsegv: Clarify license of the *.m4 files.
ASSERT (name);
ASSERT (grantpt (master) == 0);
ASSERT (unlockpt (master) == 0);
+
+#if defined __HAIKU__
+ /* On Haiku, the open() call below succeeds only if
+ - done in a child process, and
+ - if that child process has done a setsid() call.
+ So, do that. */
+ pid_t child_pid = fork ();
+ ASSERT (child_pid >= 0);
+ if (child_pid > 0)
+ {
+ /* We are in the parent. Wait for the child to terminate. */
+ int child_status;
+ ASSERT (waitpid (child_pid, &child_status, 0) != -1);
+ ASSERT (WIFEXITED (child_status));
+ int child_exit_status = WEXITSTATUS (child_status);
+ ASSERT (child_exit_status == 0);
+
+ return test_exit_status;
+ }
+ /* We are in the child. */
+ ASSERT (setsid () >= 0);
+#endif
+
slave = open (name, O_RDWR);
ASSERT (0 <= slave);