Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!bellcore!faline!ulysses!gatech!emory!km From: km@emory.uucp (Ken Mandelberg) Newsgroups: comp.windows.x Subject: Re: Termination Problem using X11 on Sun3/50 (Sol'n) Message-ID: <2258@emory.uucp> Date: Fri, 25-Sep-87 00:19:22 EDT Article-I.D.: emory.2258 Posted: Fri Sep 25 00:19:22 1987 Date-Received: Sat, 26-Sep-87 19:55:07 EDT References: <2257@emory.uucp> Reply-To: km@emory.UUCP (Ken Mandelberg) Organization: Math & Computer Science, Emory University, Atlanta Lines: 119 Keywords: ksh sh FNDELAY I previously reported that "xinit xterm" for X11 on a Sun caused my shell to die and getty to go mad, on a normal termination. The problem was not the kbd_mode issue involved in an abnormal terminiation. The problem turns out to be my shell. I use ksh, but the same problem would occur in /bin/sh. Xsun sets FNDELAY via fcntl, and no one restored it on normal termination. This is not a problem for /bin/csh which dup's the orginal terminal fd's up to high fd numbers, and dup's them back when recovering the terminal. ksh and sh don't do that. My solution is a modification of xinit to save and restore the fcntl status flag. A diff follows: *** xinit.c Thu Sep 24 23:14:13 1987 --- xinit.c.orig Thu Sep 24 23:10:41 1987 *************** *** 13,19 **** #include #include #include - #include #define TRUE 1 #define FALSE 0 --- 13,18 ---- *************** *** 36,42 **** int serverpid = -1; int clientpid = -1; extern int errno; - int flag; /*save fcntl flag */ sigCatch(sig) int sig; --- 35,40 ---- *************** *** 45,51 **** signal(SIGINT, SIG_IGN); Error("signal %d\n", sig); shutdown(serverpid, clientpid); ! exitt(1); } main(argc, argv) --- 43,49 ---- signal(SIGINT, SIG_IGN); Error("signal %d\n", sig); shutdown(serverpid, clientpid); ! exit(1); } main(argc, argv) *************** *** 93,100 **** *sptr++ = *argv++; *sptr = NULL; - fcntl(2,F_GETFL,&flag); - /* * Start the server and client. */ --- 91,96 ---- *************** *** 112,119 **** shutdown(serverpid, clientpid); if (serverpid < 0 || clientpid < 0) ! exitt(ERR_EXIT); ! exitt(OK_EXIT); } --- 108,115 ---- shutdown(serverpid, clientpid); if (serverpid < 0 || clientpid < 0) ! exit(ERR_EXIT); ! exit(OK_EXIT); } *************** *** 187,193 **** char *fmt; { Error(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9); ! exitt(ERR_EXIT); } startServer(server) --- 183,189 ---- char *fmt; { Error(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9); ! exit(ERR_EXIT); } startServer(server) *************** *** 290,300 **** if (processTimeout(serverpid, 3, "server to die")) Fatal("Can't kill server\n"); } - exitt(i) - int i; - - { - fcntl(2, F_SETFL,flag); - exit(i); - } - --- 286,288 ---- -- Ken Mandelberg | gatech!emory!km USENET Emory University | km@emory CSNET,BITNET Dept of Math and CS | km.emory@csnet-relay ARPANET Atlanta, Ga 30322 | Phone: (404) 727-7963