* lib/dup3.c (dup3) [__HAIKU__]: Set errno to EINVAL and return -1 if
both file descriptors are equal.
* doc/posix-functions/dup3.texi: Document the Haiku bug.
+2025-03-12 Collin Funk <collin.funk1@gmail.com>
+
+ dup3: Fix behavior for equal file descriptors on Haiku.
+ * lib/dup3.c (dup3) [__HAIKU__]: Set errno to EINVAL and return -1 if
+ both file descriptors are equal.
+ * doc/posix-functions/dup3.texi: Document the Haiku bug.
+
2025-03-10 Bruno Haible <bruno@clisp.org>
quotearg: Avoid undefined behaviour.
@item
This function mistakenly succeeds when given two equal file descriptors on some platforms:
@c https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=58266
-NetBSD 10.0.
+@c https://dev.haiku-os.org/ticket/19476
+NetBSD 10.0, Haiku.
@end itemize
Portability problems not fixed by Gnulib:
{
have_dup3_really = 1;
/* On NetBSD dup3 is a no-op when oldfd == newfd, but we are
- expected to fail with error EINVAL. */
-# ifdef __NetBSD__
+ expected to fail with error EINVAL.
+
+ Likewise on Haiku. */
+# if defined __NetBSD__ || defined __HAIKU__
if (newfd == oldfd)
{
errno = EINVAL;