I think this is a clean patch. It should work on any glibc2.1 system
AFAIK. I can only test it on glibc2.1 w/pty98 support. It seems OK:
The conditional code is moved to process.h. I suppose that's where it
should go(?)
1. M-x shell
2. tty > /dev/pts/1
(good)
3. C-x k
4. M-x shell
5. tty > /dev/pts/1
(good)
6. M-x rename buffer *shell2*
7. M-x shell
8. tty > /dev/pts/2
(good)
Index: process.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/process.h,v
retrieving revision 1.8
diff -u -r1.8 process.h
--- process.h 1998/04/11 05:37:05 1.8
+++ process.h 1999/07/29 02:19:51
@@ -134,4 +134,16 @@
#endif /* emacs */
+#if defined (__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >=
1)
+# define HAVE_GETPT
+#endif
+
+#ifdef HAVE_GETPT
+#define PTY_ITERATION
+#define PTY_OPEN \
+ if ((fd = getpt()) < 0 || grantpt (fd) < 0 || unlockpt (fd) < 0) \
+ return -1;
+#define PTY_TTY_NAME_SPRINTF ptsname_r (fd, pty_name, sizeof (pty_name));
+#endif
+
#endif /* _XEMACS_PROCESS_H_ */
Index: process-unix.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/process-unix.c,v
retrieving revision 1.11.2.5
diff -u -r1.11.2.5 process-unix.c
--- process-unix.c 1998/12/29 10:54:27 1.11.2.5
+++ process-unix.c 1999/07/29 02:20:04
@@ -216,6 +216,7 @@
int fd;
int c;
+
#ifdef PTY_ITERATION
PTY_ITERATION
#else
@@ -265,7 +266,7 @@
if (access (pty_name, 6) != 0)
{
close (fd);
-#if !defined(IRIS) && !defined(__sgi)
+#if !defined(IRIS) && !defined(__sgi) && !defined (HAVE_GETPT)
continue;
#else
return -1;