Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: Sun pty problem Message-ID: <1304@auspex.UUCP> Date: 27 Mar 89 20:19:40 GMT References: <1339@cunixc.cc.columbia.edu> Reply-To: guy@auspex.UUCP (Guy Harris) Distribution: na Organization: Auspex Systems, Santa Clara Lines: 102 >What happens is that when people use a pty (via sunview or >rlogin, and usually only ttyp0) it sometimes translates all of the >characters into ^Ds, thus logging them out. The pseudo-tty has gotten into "half-remote" mode; the bug that causes this has been reported to Sun, along with a fix, and the fix will be in a future release. If you have source, you can fix it by having the pseudo-tty *controller* "open" routine check whether the slave is open (i.e., check whether there is a stream active on the slave side), and send an M_CTL message with MC_DOCANON as its contents up that stream. If you don't have source, the attached shell archive contains a program that takes the pathname for the pseudo-tty *controller* (*not* slave - e.g., hand it "/dev/ptyp0" rather than "/dev/ttyp0") and fixes it. The pseudo-tty controller must *not* be open (i.e., no "shelltool" or "cmdtool" or "in.rlogind" or "in.telnetd" or... can be using it), since pseudo-tty controllers are single-use devices. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'fixup.c' <<'END_OF_FILE' X#include X Xextern int fprintf(); X X#include X Xextern int open(); X X#include X Xextern int ioctl(); X X#include X Xextern void perror(); Xextern void exit(); X Xstatic char *strerror(); X Xint Xmain(argc, argv) X int argc; X char **argv; X{ X register int fd; X int zero = 0; X X if (argc != 2) { X (void) fprintf(stderr, "Usage: fixup pseudo-tty\n"); X return 1; X } X X if ((fd = open(argv[1], O_RDWR)) < 0) { X (void) fprintf(stderr, "fixup: Can't open %s: %s\n", argv[1], X strerror(errno)); X return 1; X } X X if (ioctl(fd, TIOCREMOTE, &zero) < 0) { X (void) fprintf(stderr, "fixup: Can't fix %s: %s\n", argv[1], X strerror(errno)); X return 1; X } X X return 0; X} X Xstatic char * Xstrerror(errnum) X int errnum; X{ X extern int sys_nerr; X extern char *sys_errlist[]; X static char msg[6+10+1]; /* "Error "+number+'\0' */ X X if (errnum < 0 || errnum > sys_nerr) { X (void) sprintf(msg, "Error %d", errnum); X return msg; X } else X return sys_errlist[errnum]; X} END_OF_FILE if test 980 -ne `wc -c <'fixup.c'`; then echo shar: \"'fixup.c'\" unpacked with wrong size! fi # end of 'fixup.c' fi echo shar: End of shell archive. exit 0