Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!pt!theory.cs.cmu.edu!tsf From: tsf@theory.cs.cmu.edu (Timothy Freeman) Newsgroups: comp.windows.x Subject: Re: Mouseproofing Message-ID: <1058@theory.cs.cmu.edu> Date: Mon, 29-Jun-87 17:20:57 EDT Article-I.D.: theory.1058 Posted: Mon Jun 29 17:20:57 1987 Date-Received: Sun, 5-Jul-87 20:19:54 EDT References: <1056@theory.cs.cmu.edu> Organization: Carnegie-Mellon University, CS/RI Lines: 73 The mouseproofing stuff I posted leaves one useless process laying around and leaks one file descriptor each time you open and close the display. Here are bug fixes to keep that from happening. The files that changed were XOpenDisplay.c, XCloseDisplay.c, and xmouseproofserver.c. [b.ergo]/usr/misc/X/Xlib% sccs sccsdiff -r1.2 -r1.3 xmouseproofserver.c -c3 *** /tmp/geta16818 Mon Jun 29 17:11:45 1987 --- /tmp/getb16818 Mon Jun 29 17:11:46 1987 *************** *** 36,41 **** --- 36,45 ---- /* blocked (the values are 0 for 0 and */ /* 1 for 1 or more. */ + if (check (fork ())) { + /* Parent */ + exit (0); /* Keep zombies from forming. */ + } signal (SIGINT, SIG_IGN); /* Don't die on control-C's! */ lispwritemask = 1<fd; int readpipes [2], writepipes [2]; check (pipe (readpipes)); check (pipe (writepipes)); ! if (check (vfork ())) { /* Parent */ close (readpipes [1]); dpy -> fd = readpipes [0]; close (writepipes [0]); --- 217,229 ---- if (proofp) { int fd = dpy -> fd; int readpipes [2], writepipes [2]; + int pid; check (pipe (readpipes)); check (pipe (writepipes)); ! if (pid = check (vfork ())) { /* Parent */ + while (wait (0) != pid); /* Avoid making zombies. */ close (readpipes [1]); dpy -> fd = readpipes [0]; close (writepipes [0]); [b.ergo]/usr/misc/X/Xlib% sccs sccsdiff -r1.1 -r1.2 XCloseDisplay.c -c3 *** /tmp/geta16855 Mon Jun 29 17:13:48 1987 --- /tmp/getb16855 Mon Jun 29 17:13:48 1987 *************** *** 26,31 **** --- 26,35 ---- /* Argh! someone already closed the descriptor! */ _XIOError(_XlibCurrentDisplay); } + if (dpy->mouseproofedp && (close(dpy->writefd) == -1)) { + /* Argh! someone already closed the descriptor! */ + _XIOError(_XlibCurrentDisplay); + } sigsetmask(sig_mask); /* Return signals to normal. */ if (dpy->displayname) free(dpy->displayname); free(dpy->buffer); -- Tim Freeman Arpanet: tsf@theory.cs.cmu.edu Uucp: ...!seismo!theory.cs.cmu.edu!tsf