frexp, frexp-nolibm: Move AC_LIBOBJ invocations to module description.
[pspp] / lib / dup2.c
index 6b72f7b73f6496894f01c8d68f109b9572b95eee..e00dc7b2e3c5f2789bc6a578a5f45be67871a2ef 100644 (file)
@@ -59,6 +59,10 @@ rpl_dup2 (int fd, int desired_fd)
       errno = EBADF;
       return -1;
     }
+# elif !defined __linux__
+  /* On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC.  */
+  if (fd == desired_fd)
+    return fcntl (fd, F_GETFL) == -1 ? -1 : fd;
 # endif
   result = dup2 (fd, desired_fd);
 # ifdef __linux__