]> Savannah Git Hosting - gnulib.git/commitdiff
mkfifoat: Work around a Haiku bug.
authorBruno Haible <bruno@clisp.org>
Fri, 30 Aug 2024 23:28:32 +0000 (01:28 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 17 Sep 2024 11:10:15 +0000 (13:10 +0200)
* lib/mknodat.c (rpl_mknodat): On Haiku, handle S_IFIFO explicitly.
* doc/posix-functions/mknodat.texi: Mention the S_IFIFO flag bug.

ChangeLog
doc/posix-functions/mknodat.texi
lib/mknodat.c

index 83b15ee13e7f461b286245e51d4211d56d8f3061..0e1cb9efb64345ad4dd67a67e0b5f1fd46abf1f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-08-30  Bruno Haible  <bruno@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.
+
 2024-08-30  Bruno Haible  <bruno@clisp.org>
 
        posix_openpt tests: Fix test failure on Haiku.
index 1dfa39c922c918ca0c75e48d5a7aa6ba753c8c92..96c9537111854ecc837188bbc9500cf2c3a115ed 100644 (file)
@@ -16,6 +16,10 @@ But the replacement function is not safe to be used in libraries and is not mult
 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:
index 66d5b3566f68e8fc3d4e2741f7134e1fd0c46bb4..a31450abab8cd9a73582fcab98a7a77c5b7ac8e6 100644 (file)
@@ -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);
 }