On Haiku, I'm seeing this test failure: FAIL: test-mkfifoat ===================
../../gltests/test-mkfifo.h:36: assertion 'result == 0' failed Abort FAIL test-mkfifoat (exit status: 149) This patch fixes that failure. The test still later fails, but in a less important way. If more platforms are affected, we should consider to adapt the autoconf test from m4/mknod.m4 to m4/mkfifoat.m4. I haven't done this yet. 2024-08-30 Bruno Haible <br...@clisp.org> mkfifoat: Work around a Haiku bug. * lib/mknodat.c (rpl_mknodat): On Haiku, handle S_IFIFO explicitly. * doc/posix-functions/mknodat.texi: Mention the S_IFIFO flag bug. diff --git a/doc/posix-functions/mknodat.texi b/doc/posix-functions/mknodat.texi index 53f695db68..a837f89b53 100644 --- a/doc/posix-functions/mknodat.texi +++ b/doc/posix-functions/mknodat.texi @@ -16,6 +16,10 @@ This function does not fail when the file name argument ends in a slash and (without the slash) names a nonexistent file, on some platforms: AIX 7.2. +@item +This function does not handle the @code{S_IFIFO} flag on some platforms: +@c https://dev.haiku-os.org/ticket/19032 +Haiku. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/mknodat.c b/lib/mknodat.c index 66d5b3566f..a31450abab 100644 --- a/lib/mknodat.c +++ b/lib/mknodat.c @@ -54,6 +54,12 @@ rpl_mknodat (int fd, char const *file, mode_t mode, dev_t dev) return -1; } +# if defined __HAIKU__ + /* POSIX requires mknodat to create fifos for non-privileged processes, but + on Haiku it fails with ENOTSUP. */ + if (S_ISFIFO (mode) && dev == 0) + return mkfifo (file, mode & ~S_IFIFO); +# endif return mknodat (fd, file, mode, dev); }