9fb684b74a
This was broken for newer FreeBSDs which give out pty names /dev/pty[pqrsPQRS][0123456789abcdefghijklmnopqrstuv] emacs, manually searching, stopped at a gap of 3 entries. But the new naming scheme allows a gap of 28. Set to 30 just in case. Actually there's no good reason not to set that to 256, it's not that 512 system calls kill us everytime someone opens a shell in emacs. Bump portsrevision so that it gets picked up by portupgrade. I wonder whether other emacsens are affected, too...
51 lines
1.2 KiB
Text
51 lines
1.2 KiB
Text
--- src/process.c.original Fri Sep 23 11:49:02 2005
|
||
+++ src/process.c Fri Sep 23 11:51:45 2005
|
||
@@ -400,6 +400,14 @@
|
||
|
||
#ifdef HAVE_PTYS
|
||
|
||
+char to_tty_char(int i)
|
||
+{
|
||
+ if (i < 10)
|
||
+ return '0' + i;
|
||
+ else
|
||
+ return 'a' + i - 10;
|
||
+}
|
||
+
|
||
/* Open an available pty, returning a file descriptor.
|
||
Return -1 on failure.
|
||
The file name of the terminal corresponding to the pty
|
||
@@ -423,13 +431,13 @@
|
||
PTY_ITERATION
|
||
#else
|
||
for (c = FIRST_PTY_LETTER; c <= 'z'; c++)
|
||
- for (i = 0; i < 16; i++)
|
||
+ for (i = 0; i < 'z' - 'a' + 1 + 10; i++)
|
||
#endif
|
||
{
|
||
#ifdef PTY_NAME_SPRINTF
|
||
PTY_NAME_SPRINTF
|
||
#else
|
||
- sprintf (pty_name, "/dev/pty%c%x", c, i);
|
||
+ sprintf (pty_name, "/dev/pty%c%c", c, to_tty_char(i));
|
||
#endif /* no PTY_NAME_SPRINTF */
|
||
|
||
#ifdef PTY_OPEN
|
||
@@ -446,7 +454,7 @@
|
||
if (stat (pty_name, &stb) < 0)
|
||
{
|
||
failed_count++;
|
||
- if (failed_count >= 3)
|
||
+ if (failed_count >= 30)
|
||
return -1;
|
||
}
|
||
else
|
||
@@ -466,7 +474,7 @@
|
||
#ifdef PTY_TTY_NAME_SPRINTF
|
||
PTY_TTY_NAME_SPRINTF
|
||
#else
|
||
- sprintf (pty_name, "/dev/tty%c%x", c, i);
|
||
+ sprintf (pty_name, "/dev/tty%c%c", c, to_tty_char(i));
|
||
#endif /* no PTY_TTY_NAME_SPRINTF */
|
||
#ifndef UNIPLUS
|
||
if (access (pty_name, 6) != 0)
|