Path: utzoo!attcan!uunet!convex!killer!tness7!bellcore!faline!thumper!ulysses!andante!alice!bst From: bst@alice.UUCP Newsgroups: comp.windows.x Subject: Re: xterm problems with SunOS 4.0 Message-ID: <8053@alice.UUCP> Date: 21 Jul 88 17:15:17 GMT References: <4328@ut-emx.UUCP> Reply-To: bst@alice.UUCP (PUT YOUR NAME HERE) Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 73 Since I'm sure a lot of people are going to be hitting this problem as they move to SUN OS4.0, here is copy of a bug report I sent to xbugs a few weeks back. This fix I've given here is not the most elegant possible, but it works. VERSION: X11 release 2 CLIENT MACHINE: Sun 3/110 CLIENT OPERATING SYSTEM: SunOS 4.0 SYNOPSIS: xterm does not work under SUN OS 4.0 on a yellow pages client. DESCRIPTION: xterm dies with a HANGUP message when run under OS4.0. The problem only occurs when running on a YP client. The new OS now keeps a file descriptor open that is a socket connected to the yp server. This reduces the overhead in making YP calls. Xterm, however, assumes that it knowns about all open file descriptors and manually dups the pseudo-tty fds into file descriptors 4 and 5. Since 4 ends up being the YP socket, this hopelessly confuses the YP routines. FIX: Diffs for xterm/main.c 920,921c919,920 < if (screen->respond < 3) { < int newrespond = dupHigh (screen->respond); --- > if (screen->respond != Xsocket + 1) { > dup2 (screen->respond, Xsocket + 1); 923c922 < screen->respond = newrespond; --- > screen->respond = Xsocket + 1; 932,933c931,932 < if (tty < 3) { < int newtty = dupHigh (tty); --- > if (tty != Xsocket + 2) { > dup2 (tty, Xsocket + 2); 935c934 < tty = newtty; --- > tty = Xsocket + 2; 1476,1494d1474 < } < < int dupHigh(oldfd) < { < int desc[3],i,j; < /* Find an fd > 2 */ < for (i=0;i<3;i++) { < desc[i] = dup(oldfd); < if (desc[i] > 2) < break; < } < if (i==3) { < fprintf(stderr,"dupHigh failed\n"); < exit(1); < } < /* Close unneeded ones */ < for (j=0;j