* 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.
/* Copy a file descriptor, applying specific flags.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
{
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;