Subject: | IO::Tty on BeOS w/fix |
IO::Tty looks in the wrong place for ptys on BSD. This patch fixes the bug:
*** OTty.xs Thu Jan 21 14:39:01 2010
--- Tty.xs Thu Jan 21 14:41:25 2010
***************
*** 710,715 ****
--- 710,730 ----
if (*ptyfd >= 0 && open_slave(ptyfd, ttyfd, namebuf, namebuflen))
break;
+ /* Try BeOS style naming */
+ sprintf(buf, "/dev/pt/%c%c",
+ ptymajors[i / num_minors],
+ ptyminors[i % num_minors]);
+ sprintf(tbuf, "/dev/tt/%c%c",
+ ptymajors[i / num_minors],
+ ptyminors[i % num_minors]);
+ if (strlcpy(namebuf, tbuf, namebuflen) >= namebuflen) {
+ warn("ERROR: pty_allocate: ttyname truncated");
+ return 0;
+ }
+ *ptyfd = open(buf, O_RDWR | O_NOCTTY);
+ if (*ptyfd >= 0 && open_slave(ptyfd, ttyfd, namebuf, namebuflen))
+ break;
+
/* Try z/OS style naming */
sprintf(buf, "/dev/ptyp%04d", i);
sprintf(tbuf, "/dev/ttyp%04d", i);