Subject: | [PATCH] downstream patch to fix issues on NetBSD |
Hi,
I found this patch in NetBSD's pkgsrc that fixes IO-Tty on NetBSD
I have applied to 1.07 and tested on NetBSD 3.1 and it builds and passes the
test-suite.
Many thanks,
--
Chris Williams
aka BinGOs
PGP ID 0x4658671F
http://www.gumbynet.org.uk
Subject: | io-tty-patch-ab.diff |
$NetBSD: patch-ab,v 1.1 2006/02/19 01:28:53 heinz Exp $
--- Tty.xs.orig 2002-03-06 14:47:32.000000000 +0100
+++ Tty.xs
@@ -300,6 +300,23 @@ open_slave(int *ptyfd, int *ttyfd, char
if (PL_dowarn)
warn("IO::Tty::pty_allocate(nonfatal): grantpt(): %.100s", strerror(errno));
}
+
+#if defined(__NetBSD__)
+ /* NetBSD >= 3.0 supports grantpt() but it invalidates the slave
+ FD (see grantpt(3) on NetBSD) obtained through openpty().
+ The slave device will be opened again below.
+ */
+ *ttyfd = -1;
+
+ /* The issue should be really fixed by using posix_openpt() instead of
+ openpty(). The functions posix_openpt(), grantpt(), unlockpt()
+ and ptsname() belong together and should be used ahead of
+ all the other ways to create the master and slave tty, not just
+ on NetBSD. See also
+ http://www.opengroup.org/onlinepubs/009695399/functions/posix_openpt.html
+ */
+#endif
+
#endif /* HAVE_GRANTPT */
#if defined(HAVE_UNLOCKPT)
#if PTY_DEBUG